mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 23:43:54 +00:00
Replace effectively unused $paramNames array
All this effectively does is counting the number of properties in the $data->params object. Change-Id: I92fff1f70b4f583c27c0e0ba7e4d7239e7790ee3
This commit is contained in:
parent
f421e4951d
commit
c6822649d5
|
@ -205,7 +205,6 @@ class TemplateDataBlob {
|
|||
// We need this to determine whether a property was originally set
|
||||
// to decide whether 'inherits' will add it or not.
|
||||
$unnormalizedParams = unserialize( serialize( $data->params ) );
|
||||
$paramNames = [];
|
||||
|
||||
foreach ( $data->params as $paramName => $paramObj ) {
|
||||
if ( !is_object( $paramObj ) ) {
|
||||
|
@ -392,8 +391,6 @@ class TemplateDataBlob {
|
|||
} else {
|
||||
$paramObj->suggestedvalues = [];
|
||||
}
|
||||
|
||||
$paramNames[] = $paramName;
|
||||
}
|
||||
|
||||
// Param.inherits
|
||||
|
@ -427,9 +424,9 @@ class TemplateDataBlob {
|
|||
return Status::newFatal( 'templatedata-invalid-type', 'paramOrder', 'array' );
|
||||
}
|
||||
|
||||
if ( count( $data->paramOrder ) < count( $paramNames ) ) {
|
||||
$i = count( $data->paramOrder );
|
||||
return Status::newFatal( 'templatedata-invalid-missing', "paramOrder[$i]" );
|
||||
if ( count( $data->paramOrder ) < count( (array)$data->params ) ) {
|
||||
$firstMissing = count( $data->paramOrder );
|
||||
return Status::newFatal( 'templatedata-invalid-missing', "paramOrder[$firstMissing]" );
|
||||
}
|
||||
|
||||
// Validate each of the values corresponds to a parameter and that there are no
|
||||
|
|
Loading…
Reference in a new issue