vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.5k stars 655 forks source link

match operator paradox #10590

Open faizanakram99 opened 5 months ago

faizanakram99 commented 5 months ago

See this https://psalm.dev/r/55fa80a15c , it is equivalent to https://psalm.dev/r/230b8f1197 (which seems fine to psalm).

psalm-github-bot[bot] commented 5 months ago

I found these snippets:

https://psalm.dev/r/55fa80a15c ```php environmentType->isProductionEnvironment(), $this->environmentType->isBackupEnvironment(), $this->environmentType->isAcceptanceEnvironment() => 'https://x.com', default => 'https://y.com', }; } } ``` ``` Psalm output (using commit 3c90054): ERROR: ParadoxicalCondition - 24:13 - Condition () contradicts a previously-established condition (!) ```
https://psalm.dev/r/230b8f1197 ```php environmentType->isProductionEnvironment() || $this->environmentType->isBackupEnvironment() || $this->environmentType->isAcceptanceEnvironment() ) { 'https://x.com'; } return 'https://y.com'; } } ``` ``` Psalm output (using commit 3c90054): No issues! ```