File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
tests/PHPStan/Analyser/data Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ class ClosureArgVisitor extends NodeVisitorAbstract
1313
1414 public function enterNode (Node $ node ): ?Node
1515 {
16- if ($ node instanceof Node \Expr \FuncCall && $ node ->name instanceof Node \Expr \Closure) {
17- $ args = $ node ->getRawArgs ();
16+ if ($ node instanceof Node \Expr \FuncCall && $ node ->name instanceof Node \Expr \Closure && ! $ node -> isFirstClassCallable () ) {
17+ $ args = $ node ->getArgs ();
1818
1919 if (count ($ args ) > 0 ) {
2020 $ node ->name ->setAttribute (self ::ATTRIBUTE_NAME , $ args );
Original file line number Diff line number Diff line change @@ -10,4 +10,11 @@ function say(\Closure $bar): string
1010function (): void {
1111 echo say (fn (string $ name = null ) => 'Hi ' );
1212 echo say ((fn (string $ name = null ) => 'Hi ' )(...));
13+
14+ echo say (function (string $ name = null ) {
15+ return 'Hi ' ;
16+ });
17+ echo say ((function (string $ name = null ) {
18+ return 'Hi ' ;
19+ })(...));
1320};
You can’t perform that action at this time.
0 commit comments