Skip to content

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Apr 30, 2025

Hello!

Closes phpstan/phpstan#11340

This PR adds the following two option (false by default):

  • reportIgnoresWithoutIdentifiers: reports @phpstan-ignore-line and @phpstan-ignore-next-line usages
  • reportIgnoresWithoutComments: reports @phpstan-ignore usages without comments

Thanks!

@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 94bcb68 to 47d8329 Compare April 30, 2025 18:29
@calebdw
Copy link
Contributor Author

calebdw commented Apr 30, 2025

CI failures look to be unrelated

@calebdw calebdw changed the title feat: add option to report ignores without identifiers feat: add options to report ignores without identifiers or comments Apr 30, 2025
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch 2 times, most recently from 384c8af to 0475ff1 Compare April 30, 2025 21:05
@NanoSector
Copy link

Thanks for providing this & also picking up the case for no comments 🙌

@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 0475ff1 to a63175b Compare May 10, 2025 21:44
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch 2 times, most recently from e976b0d to 8e4e5f8 Compare May 22, 2025 12:25
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 8e4e5f8 to 2a4b464 Compare May 29, 2025 13:04
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch 3 times, most recently from ae45feb to 3b7dc03 Compare June 21, 2025 04:43
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 3b7dc03 to 3154768 Compare July 14, 2025 18:54
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 3154768 to e36cd48 Compare September 13, 2025 12:35
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from e36cd48 to eb04e1d Compare November 26, 2025 14:33
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch 2 times, most recently from f6aba44 to db2e46f Compare January 23, 2026 22:17
@ondrejmirtes
Copy link
Member

I'm thinking about deprecating @phpstan-ignore-line and @phpstan-ignore-next-line completely now and removing them in 3.0. Because people often use them with identifiers by mistake, but these comments ignore all errors anyway. So I don't want to add reportIgnoresWithoutIdentifiers now.

We'd have to add a support for new comment @phpstan-ignore-all-errors to have a replacement for these though.

As for reportIgnoresWithoutComments, yeah, that one makes sense to me and I'd accept it.

@calebdw
Copy link
Contributor Author

calebdw commented Feb 11, 2026

Sounds good---I'll update

We'd have to add a support for new comment @phpstan-ignore-all-errors to have a replacement for these though.

That's good---however, consider adding an option to enable/disable this when the new comment is added. Some projects may want to complete disable this and not allow such a global ignore

@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from db2e46f to b1cedbf Compare February 11, 2026 16:38
@calebdw calebdw changed the title feat: add options to report ignores without identifiers or comments feat: add option to report ignores without comments Feb 11, 2026
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch 3 times, most recently from 8f3e261 to 1d62fec Compare February 11, 2026 17:14
@calebdw calebdw force-pushed the calebdw/push-qtlvsunynsrq branch from 1d62fec to 5dd8312 Compare February 11, 2026 17:17
@derrabus
Copy link

I'm thinking about deprecating @phpstan-ignore-line and @phpstan-ignore-next-line completely now and removing them in 3.0. Because people often use them with identifiers by mistake, but these comments ignore all errors anyway. So I don't want to add reportIgnoresWithoutIdentifiers now.

A deprecation would also work for me. I want to rid my codebases of those annotations, so as long as an error pops up if one of the old annotations is used, I'm happy. ✌🏻

@calebdw
Copy link
Contributor Author

calebdw commented Feb 11, 2026

@ondrejmirtes, this is ready for review 👍

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.

Option to disable phpstan-ignore-line and phpstan-ignore-next-line

4 participants