Skip to content

Suggestion about usage of checkAlwaysTrueStrictComparison #11051

Discussion options

You must be logged in to vote

You're probably using an old PHPStan version, that's why it doesn't show up in the playground.

I agree that if you want to handle all enum cases, default is counterproductive. It's better to remove default and let PHPStan tell you you're missing a case: https://phpstan.org/r/8dc983c5-0f75-43fa-a051-c906e3f837fe

Also please note there are some changed if you enable Bleeding Edge:

  1. "always true" comparisons are always reported for everyone, the options to enable it will be removed in PHPStan 2.0
  2. Compare the behaviour in this example: https://phpstan.org/r/de4a9720-2429-4021-8a68-18e72deb125a vs https://phpstan.org/r/5c9256ad-f4ed-4ff5-9ede-d08dae65fedd

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@grga-giscloud
Comment options

@ondrejmirtes
Comment options

@grga-giscloud
Comment options

Answer selected by grga-giscloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants