phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

Can't ignore error in @return

Open rdk-pmis opened this issue 1 year ago • 1 comments

Bug report

When I want to ignore an error in an @return statement, I add the @php-ignore line above the @return statement. Parsers doesn't like that. I get an error: Parse error in @phpstan-ignore: Unexpected T_OTHER '@return' after end, expected comma (,) or end

Code snippet that reproduces the problem

https://phpstan.org/r/175063bb-6b86-467f-8374-a0008aa964ca

Expected output

No error and the error in @return suppressed

Did PHPStan help you today? Did it make you happy in any way?

No response

rdk-pmis avatar Aug 16 '24 14:08 rdk-pmis

/cc @janedbal We've talked about this, it would be useful to implement it 😊

Right now in this case you still have to use @phpstan-ignore-next-line.

ondrejmirtes avatar Aug 16 '24 16:08 ondrejmirtes

Both @phpstan-ignore and @phpstan-ignore-next-line require to be the last annotation when inside a doc comment.

See: https://phpstan.org/r/2b5ec0a9-422f-4c11-bf7f-a525aa7bb8aa

MauricioFauth avatar Jul 09 '25 20:07 MauricioFauth