Skip to content

Commit

Permalink
Merge pull request #260 from PHPCSStandards/feature/passedparameters-…
Browse files Browse the repository at this point in the history
…minor-efficiency-tweak

PassedParameters: minor efficiency tweak
  • Loading branch information
jrfnl committed May 16, 2021
2 parents 79a8501 + 0f5cf09 commit e6f27a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PHPCSUtils/Utils/PassedParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,14 @@ public static function getParameterFromStack(array $parameters, $paramOffset, $p
return $parameters[$paramOffset];
}

$paramNames = \array_flip((array) $paramNames);
if (empty($paramNames) === true) {
throw new RuntimeException(
'To allow for support for PHP 8 named parameters, the $paramNames parameter must be passed.'
);
}

$paramNames = \array_flip((array) $paramNames);

// Next check if a named parameter was passed with the specified name.
foreach ($parameters as $paramDetails) {
if (isset($paramDetails['name']) === false) {
Expand Down

0 comments on commit e6f27a9

Please sign in to comment.