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:
Thiemo Kreuz 2022-02-01 15:35:10 +01:00
parent f421e4951d
commit c6822649d5

View file

@ -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