@@ -23,12 +23,14 @@ class CallToFunctionParametersRuleTest extends RuleTestCase
2323
2424 private bool $ checkImplicitMixed = false ;
2525
26+ private int $ phpVersion = PHP_VERSION_ID ;
27+
2628 protected function getRule (): Rule
2729 {
2830 $ broker = $ this ->createReflectionProvider ();
2931 return new CallToFunctionParametersRule (
3032 $ broker ,
31- new FunctionCallParametersCheck (new RuleLevelHelper ($ broker , true , false , true , $ this ->checkExplicitMixed , $ this ->checkImplicitMixed , true , false ), new NullsafeCheck (), new PhpVersion (80000 ), new UnresolvableTypeHelper (), new PropertyReflectionFinder (), true , true , true , true , true ),
33+ new FunctionCallParametersCheck (new RuleLevelHelper ($ broker , true , false , true , $ this ->checkExplicitMixed , $ this ->checkImplicitMixed , true , false ), new NullsafeCheck (), new PhpVersion ($ this -> phpVersion ), new UnresolvableTypeHelper (), new PropertyReflectionFinder (), true , true , true , true , true ),
3234 );
3335 }
3436
@@ -481,24 +483,55 @@ public function testGenericFunction(): void
481483
482484 public function testNamedArguments (): void
483485 {
484- $ errors = [
485- [
486- 'Missing parameter $j (int) in call to function FunctionNamedArguments\foo. ' ,
487- 7 ,
488- ],
489- [
490- 'Unknown parameter $z in call to function FunctionNamedArguments\foo. ' ,
491- 8 ,
492- ],
493- [
494- 'Unknown parameter $a in call to function array_merge. ' ,
495- 14 ,
496- ],
497- ];
498486 if (PHP_VERSION_ID < 80000 ) {
499- $ errors [] = [
500- 'Missing parameter $arr1 (array) in call to function array_merge. ' ,
501- 14 ,
487+ $ errors = [
488+ [
489+ 'Named arguments are supported only on PHP 8.0 and later. ' ,
490+ 7 ,
491+ ],
492+ [
493+ 'Missing parameter $j (int) in call to function FunctionNamedArguments\foo. ' ,
494+ 7 ,
495+ ],
496+ [
497+ 'Named arguments are supported only on PHP 8.0 and later. ' ,
498+ 8 ,
499+ ],
500+ [
501+ 'Unknown parameter $z in call to function FunctionNamedArguments\foo. ' ,
502+ 8 ,
503+ ],
504+ [
505+ 'Named arguments are supported only on PHP 8.0 and later. ' ,
506+ 13 ,
507+ ],
508+ [
509+ 'Named arguments are supported only on PHP 8.0 and later. ' ,
510+ 14 ,
511+ ],
512+ [
513+ 'Unknown parameter $a in call to function array_merge. ' ,
514+ 14 ,
515+ ],
516+ [
517+ 'Missing parameter $arr1 (array) in call to function array_merge. ' ,
518+ 14 ,
519+ ],
520+ ];
521+ } else {
522+ $ errors = [
523+ [
524+ 'Missing parameter $j (int) in call to function FunctionNamedArguments\foo. ' ,
525+ 7 ,
526+ ],
527+ [
528+ 'Unknown parameter $z in call to function FunctionNamedArguments\foo. ' ,
529+ 8 ,
530+ ],
531+ [
532+ 'Unknown parameter $a in call to function array_merge. ' ,
533+ 14 ,
534+ ],
502535 ];
503536 }
504537
0 commit comments