phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Prevent false positive on `method_exists()` and `function_exists()`

Open staabm opened this issue 3 years ago • 3 comments

Pre-existing tests have different expectations regarding the "is always true/false" results, then what was discussed in the linked issue. I wonder when/how we should/can differentiate whether we expect this "is always true/false" error or not.

I just did the trivial version, so we can see how this violates existing expectations and start discussion/feedback from here.

closes https://github.com/phpstan/phpstan/issues/8980

staabm avatar Mar 07 '23 19:03 staabm

Maybe there should be a config switch to enable/disable this rule for function/method_exists?

staabm avatar Mar 08 '23 07:03 staabm

This pull request has been marked as ready for review.

phpstan-bot avatar Mar 09 '23 10:03 phpstan-bot

Should this also account for property_exists()?

westonruter avatar Mar 23 '23 21:03 westonruter