Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 23, 2025

not sure about those remaining errors in tests, whether there are intentional errors or not

------------------------------------------------------------
Parse error: tests/PHPStan/Rules/DeadCode/data/call-to-static-method-without-impure-points-pipe.php:17
    15| function (): void {
    16| 	5 |> Foo::doFoo(...);
  > 17| 	5 |> fn ($x) => Foo::doFoo($x);
    18| };
Arrow functions on the right hand side of |> must be parenthesized
------------------------------------------------------------
Parse error: tests/PHPStan/Rules/DeadCode/data/call-to-function-without-impure-points-pipe.php:10
     8| 
     9| 5 |> myFunc(...);
  > 10| 5 |> fn ($x) => myFunc($x);
Arrow functions on the right hand side of |> must be parenthesized
------------------------------------------------------------
Parse error: tests/PHPStan/Rules/DeadCode/data/call-to-method-without-impure-points-pipe.php:18
    16| 	$foo = new Foo();
    17| 	5 |> $foo->maybePure(...);
  > 18| 	5 |> fn ($x) => $foo->maybePure($x);
    19| };
Arrow functions on the right hand side of |> must be parenthesized

@ondrejmirtes
Copy link
Member

Asking about this to see if PHP should handle this differently: php/php-src#19533 (comment)

If PHP is going to stay the same about this I'm going to ask for a change in PHP-Parser so that this becomes a parse error.

@ondrejmirtes ondrejmirtes merged commit 73aedf6 into phpstan:2.1.x Oct 24, 2025
282 of 283 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the build2 branch October 24, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants