Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Type/Constant/ConstantFloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
use PHPStan\Type\Traits\ConstantScalarTypeTrait;
use PHPStan\Type\Type;
use PHPStan\Type\VerbosityLevel;
use function abs;
use function is_finite;
use function strpos;
use const PHP_FLOAT_EPSILON;

/** @api */
class ConstantFloatType extends FloatType implements ConstantScalarType
Expand Down Expand Up @@ -52,7 +54,7 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
{
if ($type instanceof self) {
if (!$this->equals($type)) {
if ($this->describe(VerbosityLevel::value()) === $type->describe(VerbosityLevel::value())) {
if (abs($this->value - $type->value) < PHP_FLOAT_EPSILON) {
return TrinaryLogic::createMaybe();
}

Expand Down