Open jnvsor opened 4 years ago
Hey @jnvsor, can you reproduce the issue on https://psalm.dev ?
@muglug Sorry to bother you but I'm still seeing 6 of these errors after updating to 6acd667 and running psalm --clear-cache
A quick look at that commit for some hints: My consts are bool
, not mixed, and psalm is reading them as true
Below are the 6 errors:
ERROR: RedundantCondition - src/CallFinder.php:147:13 - if (true) is redundant (see https://psalm.dev/122)
if (KINT_PHP70) {
ERROR: RedundantCondition - src/CallFinder.php:151:13 - if (true) is redundant (see https://psalm.dev/122)
if (KINT_PHP74) {
ERROR: RedundantCondition - src/Parser/Parser.php:491:23 - if (true) is redundant (see https://psalm.dev/122)
} elseif (KINT_PHP72) {
ERROR: RedundantCondition - src/Parser/SerializePlugin.php:70:17 - if (true) is redundant (see https://psalm.dev/122)
if (KINT_PHP70) {
ERROR: RedundantCondition - src/Zval/MethodValue.php:67:13 - if (true) is redundant (see https://psalm.dev/122)
if (KINT_PHP70) {
ERROR: RedundantCondition - src/Zval/ParameterValue.php:43:13 - if (true) is redundant (see https://psalm.dev/122)
if (KINT_PHP70) {
I've updated the branch linked in above
I'm seeing this issue crop up in constants used feature flags. With something like this:
I get a
RedundantCondition - if (true) is redundant
The annoying thing is I can't reproduce this in the sandbox. I thought this might be because of the constants being set in a file that is loaded through composer's file autoloading, but a smaller test case didn't prove that.
I've pushed the codebase that causes this to https://github.com/jnvsor/kint/tree/psalm-bug - psalm can be run with
composer analyze
(orpsalm --show-info=false
)Please ignore the other outstanding errors, I've reported them as psalm bugs already