diff --git a/src/Type/NeverType.php b/src/Type/NeverType.php index 0d931ebe89..ef2c90575a 100644 --- a/src/Type/NeverType.php +++ b/src/Type/NeverType.php @@ -12,15 +12,15 @@ use PHPStan\Reflection\Type\UnresolvedPropertyPrototypeReflection; use PHPStan\ShouldNotHappenException; use PHPStan\TrinaryLogic; -use PHPStan\Type\Traits\FalseyBooleanTypeTrait; use PHPStan\Type\Traits\NonGenericTypeTrait; +use PHPStan\Type\Traits\UndecidedBooleanTypeTrait; use PHPStan\Type\Traits\UndecidedComparisonCompoundTypeTrait; /** @api */ class NeverType implements CompoundType { - use FalseyBooleanTypeTrait; + use UndecidedBooleanTypeTrait; use NonGenericTypeTrait; use UndecidedComparisonCompoundTypeTrait; diff --git a/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php index 9c2d60b0a3..e53e3a8630 100644 --- a/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php @@ -56,7 +56,7 @@ public function testRule(): void 27, ], [ - 'Right side of && is always false.', + 'Result of && is always false.', 30, ], [ diff --git a/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php index c9f5b5932e..d0cc3d0fe6 100644 --- a/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php @@ -60,7 +60,7 @@ public function testRule(): void 30, ], [ - 'Right side of || is always false.', + 'Result of || is always true.', 33, ], [ @@ -175,4 +175,10 @@ public function testTreatPhpDocTypesAsCertainRegression(bool $treatPhpDocTypesAs $this->analyse([__DIR__ . '/data/boolean-or-treat-phpdoc-types-regression.php'], []); } + public function testBug6258(): void + { + $this->treatPhpDocTypesAsCertain = true; + $this->analyse([__DIR__ . '/data/bug-6258.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Comparison/data/bug-6258.php b/tests/PHPStan/Rules/Comparison/data/bug-6258.php new file mode 100644 index 0000000000..9a04e99fbf --- /dev/null +++ b/tests/PHPStan/Rules/Comparison/data/bug-6258.php @@ -0,0 +1,17 @@ +assertSame('bool', $type->toBoolean()->describe(VerbosityLevel::precise())); + $this->assertSame('true', $type->toBoolean()->describe(VerbosityLevel::precise())); } }