-
Notifications
You must be signed in to change notification settings - Fork 574
Return null from ArgumentsNormalizer::reorderArgs() when positional args after named args create holes beyond parameter count
#5637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
870a551
f6df338
87fb7f1
1845afd
3dac478
a3f1200
fab7761
9731b86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?php | ||
|
|
||
| namespace Bug14596; | ||
|
|
||
| function foo(int $a, int $b, int $c, string ...$rest): void {} | ||
|
|
||
| class Foo { | ||
| public function bar(int $a, int $b, int $c, string ...$rest): void {} | ||
| public static function baz(int $a, int $b, int $c, string ...$rest): void {} | ||
| public function __construct(int $a, int $b, int $c, string ...$rest) {} | ||
| } | ||
|
|
||
| // built-in function | ||
| \PHPStan\dumpType(1, 2, 3, d: 'foo', 5); | ||
|
|
||
| // user-defined function | ||
| foo(1, 2, 3, d: 'foo', 5); | ||
|
|
||
| // method call | ||
| $obj = new Foo(1, 2, 3); | ||
| $obj->bar(1, 2, 3, d: 'foo', 5); | ||
|
|
||
| // static method call | ||
| Foo::baz(1, 2, 3, d: 'foo', 5); | ||
|
Comment on lines
+19
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @phpstan-bot cover this example also in CallMethodsRuleTest, CallStaticMethodsRuleTest and assert expected errors
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed. Added |
||
|
|
||
| // constructor | ||
| new Foo(1, 2, 3, d: 'foo', 5); | ||
|
|
||
| // closure | ||
| $closure = function (int $a, int $b, int $c, string ...$rest): void {}; | ||
| $closure(1, 2, 3, d: 'foo', 5); | ||
|
|
||
| // call_user_func | ||
| call_user_func('Bug14596\foo', 1, 2, 3, d: 'foo', 5); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| namespace Bug14596Methods; | ||
|
|
||
| class Foo { | ||
| public function bar(int $a, int $b, int $c, string ...$rest): void {} | ||
| public static function baz(int $a, int $b, int $c, string ...$rest): void {} | ||
| } | ||
|
|
||
| function (Foo $obj): void { | ||
| $obj->bar(1, 2, 3, d: 'foo', 5); | ||
| Foo::baz(1, 2, 3, d: 'foo', 5); | ||
| }; |
Uh oh!
There was an error while loading. Please reload this page.