{{ message }}
Repository navigation
Replies: 1 comment
|
I (ab)use asserts not only as hints for myself, but also as type hints for my IDE. I would love to have an option to turn off |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have the common problem that I have to silence phpstan errors with assert() usage because phpstan figures out that the assert will never fail. While that is not wrong, the assert is there to avoid any logic errors for future changes, and it also communicates to the developer of certain conditions that are supposed to be always true, so I don't mind it being redundant.
For example:
It's quite easy to put a "ignore-next-line" there, but usually it just means people will remove assert() calls, making the it easier for future code changes to introduce bugs.
I don't know a good solution there, except maybe have a config option to ignore certain types of errors for
assert()specifically. And maybe I'm the only one being bothered by it :)Either way, thanks for phpstan.
All reactions