diff --git a/build/PHPStan/Build/RequiredPhpVersionVisitor.php b/build/PHPStan/Build/RequiredPhpVersionVisitor.php index 3ba7ed05635..ecb3a87de54 100644 --- a/build/PHPStan/Build/RequiredPhpVersionVisitor.php +++ b/build/PHPStan/Build/RequiredPhpVersionVisitor.php @@ -125,6 +125,10 @@ public function enterNode(Node $node): ?Node } } + if ($node instanceof Node\Arg && $node->name !== null) { + $this->require(self::PHP_8_0, 'named arguments', $node); + } + $this->checkStandaloneType($node); $this->checkMixedType($node); diff --git a/tests/PHPStan/Analyser/data/bug-14596.php b/tests/PHPStan/Analyser/data/bug-14596.php index 8904c0c8059..c8028a43e2f 100644 --- a/tests/PHPStan/Analyser/data/bug-14596.php +++ b/tests/PHPStan/Analyser/data/bug-14596.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug14596; diff --git a/tests/PHPStan/Analyser/data/bug-9428.php b/tests/PHPStan/Analyser/data/bug-9428.php index 90d47479f14..596c99c0d14 100644 --- a/tests/PHPStan/Analyser/data/bug-9428.php +++ b/tests/PHPStan/Analyser/data/bug-9428.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9428; diff --git a/tests/PHPStan/Analyser/data/discussion-7124.php b/tests/PHPStan/Analyser/data/discussion-7124.php index 4560c0954e8..29a8d1f5f50 100644 --- a/tests/PHPStan/Analyser/data/discussion-7124.php +++ b/tests/PHPStan/Analyser/data/discussion-7124.php @@ -1,4 +1,4 @@ -= 8.0 namespace Discussion7124; diff --git a/tests/PHPStan/Analyser/nsrt/bug-4510.php b/tests/PHPStan/Analyser/nsrt/bug-4510.php index 3c5b2c52f70..c5cedb77142 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-4510.php +++ b/tests/PHPStan/Analyser/nsrt/bug-4510.php @@ -1,4 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug4510; diff --git a/tests/PHPStan/Analyser/nsrt/bug-5262.php b/tests/PHPStan/Analyser/nsrt/bug-5262.php index 229d9fbeb28..e60eb70499e 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-5262.php +++ b/tests/PHPStan/Analyser/nsrt/bug-5262.php @@ -1,4 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug5262; diff --git a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php index 16a8eb2684f..33e82077e4b 100644 --- a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php +++ b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php @@ -132,6 +132,13 @@ public static function dataDetectedVersion(): iterable yield 'nullable union type' => [' [' [' [' ['bar(baz: 1);', 80000]; + yield 'named argument in nullsafe method call' => ['bar(baz: 1);', 80000]; + yield 'named argument in static call' => [' [' [' [' [' [' ['= 8.0 namespace ClassAttributes; diff --git a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php index f226cb36585..ed1047d0207 100644 --- a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php @@ -391,27 +391,27 @@ public function testBug4510(): void $this->analyse([__DIR__ . '/../../Analyser/nsrt/bug-4510.php'], [ [ 'Trying to invoke array{$this(Bug4510\HelloWorld), string} but it might not be a callable.', - 16, + 17, ], [ 'Trying to invoke array{Bug4510\HelloWorld, string} but it might not be a callable.', - 27, + 28, ], [ "Trying to invoke array{'Bug4510\\\HelloWorld', string} but it might not be a callable.", - 46, + 47, ], [ 'Trying to invoke array{Bug4510\HelloWorld, string} but it might not be a callable.', - 90, + 91, ], [ 'Trying to invoke array{Bug4510\HelloWorld, string} but it might not be a callable.', - 118, + 119, ], [ 'Trying to invoke array{Bug4510\HelloWorld, string} but it might not be a callable.', - 133, + 134, ], ]); } diff --git a/tests/PHPStan/Rules/Functions/data/array_values_list.php b/tests/PHPStan/Rules/Functions/data/array_values_list.php index 7eef89c9cdd..9b8cbbd4a97 100644 --- a/tests/PHPStan/Rules/Functions/data/array_values_list.php +++ b/tests/PHPStan/Rules/Functions/data/array_values_list.php @@ -1,4 +1,4 @@ -= 8.0 /** @var list $list */ $list = [1, 2, 3]; diff --git a/tests/PHPStan/Rules/Functions/data/bug-11418.php b/tests/PHPStan/Rules/Functions/data/bug-11418.php index 8172892d95c..6df92d50c38 100755 --- a/tests/PHPStan/Rules/Functions/data/bug-11418.php +++ b/tests/PHPStan/Rules/Functions/data/bug-11418.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug11418; diff --git a/tests/PHPStan/Rules/Functions/data/bug-13719.php b/tests/PHPStan/Rules/Functions/data/bug-13719.php index 8a33eb50f37..942e58002ea 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-13719.php +++ b/tests/PHPStan/Rules/Functions/data/bug-13719.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug13719; diff --git a/tests/PHPStan/Rules/Functions/data/bug-8046.php b/tests/PHPStan/Rules/Functions/data/bug-8046.php index 368f656341e..ae243ca257c 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-8046.php +++ b/tests/PHPStan/Rules/Functions/data/bug-8046.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug8046; diff --git a/tests/PHPStan/Rules/Functions/data/bug-9823.php b/tests/PHPStan/Rules/Functions/data/bug-9823.php index 3c8b3cfb775..38cfa8e65b4 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-9823.php +++ b/tests/PHPStan/Rules/Functions/data/bug-9823.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9823; diff --git a/tests/PHPStan/Rules/Functions/data/callables-named-arguments.php b/tests/PHPStan/Rules/Functions/data/callables-named-arguments.php index 38e04e86c94..f55d8f583b1 100644 --- a/tests/PHPStan/Rules/Functions/data/callables-named-arguments.php +++ b/tests/PHPStan/Rules/Functions/data/callables-named-arguments.php @@ -1,4 +1,4 @@ -= 8.0 namespace CallablesNamedArguments; diff --git a/tests/PHPStan/Rules/Functions/data/constant-parameter-check.php b/tests/PHPStan/Rules/Functions/data/constant-parameter-check.php index 70878d4eee7..48b082b0e15 100644 --- a/tests/PHPStan/Rules/Functions/data/constant-parameter-check.php +++ b/tests/PHPStan/Rules/Functions/data/constant-parameter-check.php @@ -1,4 +1,4 @@ -= 8.0 namespace ConstantParameterCheck; diff --git a/tests/PHPStan/Rules/Functions/data/function-call-statement-no-side-effects-8.0.php b/tests/PHPStan/Rules/Functions/data/function-call-statement-no-side-effects-8.0.php index 497de173104..197b68e3318 100644 --- a/tests/PHPStan/Rules/Functions/data/function-call-statement-no-side-effects-8.0.php +++ b/tests/PHPStan/Rules/Functions/data/function-call-statement-no-side-effects-8.0.php @@ -1,4 +1,4 @@ -= 8.0 namespace FunctionCallStatementNoSideEffectsPhp8; diff --git a/tests/PHPStan/Rules/Functions/data/implode-named-parameters.php b/tests/PHPStan/Rules/Functions/data/implode-named-parameters.php index 8e016b51579..a7385860710 100644 --- a/tests/PHPStan/Rules/Functions/data/implode-named-parameters.php +++ b/tests/PHPStan/Rules/Functions/data/implode-named-parameters.php @@ -1,4 +1,4 @@ -= 8.0 namespace ImplodeNamedParameters; diff --git a/tests/PHPStan/Rules/Functions/data/named-arguments-after-unpacking.php b/tests/PHPStan/Rules/Functions/data/named-arguments-after-unpacking.php index 29d9ac8b4e7..b9a9c0b2a3b 100755 --- a/tests/PHPStan/Rules/Functions/data/named-arguments-after-unpacking.php +++ b/tests/PHPStan/Rules/Functions/data/named-arguments-after-unpacking.php @@ -1,4 +1,4 @@ -= 8.0 namespace FunctionNamedArgumentsAfterUnpacking; diff --git a/tests/PHPStan/Rules/Functions/data/named-arguments.php b/tests/PHPStan/Rules/Functions/data/named-arguments.php index 4cda8071d1d..3542672ff29 100644 --- a/tests/PHPStan/Rules/Functions/data/named-arguments.php +++ b/tests/PHPStan/Rules/Functions/data/named-arguments.php @@ -1,4 +1,4 @@ -= 8.0 namespace FunctionNamedArguments; diff --git a/tests/PHPStan/Rules/Methods/data/bug-14596.php b/tests/PHPStan/Rules/Methods/data/bug-14596.php index f35305cdc31..973c6716a6e 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-14596.php +++ b/tests/PHPStan/Rules/Methods/data/bug-14596.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug14596Methods; diff --git a/tests/PHPStan/Rules/Methods/data/bug-5898.php b/tests/PHPStan/Rules/Methods/data/bug-5898.php index cbf5e3cb475..315a1bbfffc 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-5898.php +++ b/tests/PHPStan/Rules/Methods/data/bug-5898.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug5898; diff --git a/tests/PHPStan/Rules/Methods/data/bug-7434.php b/tests/PHPStan/Rules/Methods/data/bug-7434.php index be1750fdfbc..692799146af 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-7434.php +++ b/tests/PHPStan/Rules/Methods/data/bug-7434.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug7434; diff --git a/tests/PHPStan/Rules/Methods/data/constant-parameter-check-methods.php b/tests/PHPStan/Rules/Methods/data/constant-parameter-check-methods.php index 8025fc62d65..4b69554a4b1 100644 --- a/tests/PHPStan/Rules/Methods/data/constant-parameter-check-methods.php +++ b/tests/PHPStan/Rules/Methods/data/constant-parameter-check-methods.php @@ -1,4 +1,4 @@ -= 8.0 namespace ConstantParameterCheckMethods; diff --git a/tests/PHPStan/Rules/Methods/data/disallow-named-arguments-php-version-scope.php b/tests/PHPStan/Rules/Methods/data/disallow-named-arguments-php-version-scope.php index 174fef244db..7302d5cf1a7 100644 --- a/tests/PHPStan/Rules/Methods/data/disallow-named-arguments-php-version-scope.php +++ b/tests/PHPStan/Rules/Methods/data/disallow-named-arguments-php-version-scope.php @@ -1,4 +1,4 @@ -= 8.0 namespace DisallowNamedArgumentsInPhpVersionScope; diff --git a/tests/PHPStan/Rules/Methods/data/disallow-named-arguments.php b/tests/PHPStan/Rules/Methods/data/disallow-named-arguments.php index daff44a02b9..4ec3be6e6ef 100644 --- a/tests/PHPStan/Rules/Methods/data/disallow-named-arguments.php +++ b/tests/PHPStan/Rules/Methods/data/disallow-named-arguments.php @@ -1,4 +1,4 @@ -= 8.0 namespace DisallowNamedArguments; diff --git a/tests/PHPStan/Rules/Methods/data/named-arguments.php b/tests/PHPStan/Rules/Methods/data/named-arguments.php index 2896572193d..9b79bb05bde 100644 --- a/tests/PHPStan/Rules/Methods/data/named-arguments.php +++ b/tests/PHPStan/Rules/Methods/data/named-arguments.php @@ -1,4 +1,4 @@ -= 8.0 namespace NamedArgumentsMethod; diff --git a/tests/PHPStan/Rules/Methods/data/static-method-named-arguments.php b/tests/PHPStan/Rules/Methods/data/static-method-named-arguments.php index 4046b4b1c0b..b05a185dff2 100644 --- a/tests/PHPStan/Rules/Methods/data/static-method-named-arguments.php +++ b/tests/PHPStan/Rules/Methods/data/static-method-named-arguments.php @@ -1,4 +1,4 @@ -= 8.0 namespace StaticMethodNamedArguments;