Skip to content

Commit 0cb4788

Browse files
committed
fix
1 parent 9c2fd64 commit 0cb4788

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Analyser/ConstantResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
final class ConstantResolver
3535
{
3636

37-
public const PHP_MIN_VERSION_ID = 50207;
37+
public const PHP_MIN_ANALYZABLE_VERSION_ID = 50207;
3838

3939
/** @var array<string, true> */
4040
private array $currentlyResolving = [];
@@ -143,7 +143,7 @@ public function resolvePredefinedConstant(string $resolvedConstantName): ?Type
143143
return $this->createInteger($minRelease, $maxRelease);
144144
}
145145
if ($resolvedConstantName === 'PHP_VERSION_ID') {
146-
$minVersion = self::PHP_MIN_VERSION_ID;
146+
$minVersion = self::PHP_MIN_ANALYZABLE_VERSION_ID;
147147
$maxVersion = null;
148148
if ($minPhpVersion !== null) {
149149
$minVersion = max($minVersion, $minPhpVersion->getVersionId());

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
use PHPStan\Parser\NewAssignedToPropertyVisitor;
5353
use PHPStan\Parser\Parser;
5454
use PHPStan\Php\PhpVersion;
55+
use PHPStan\Php\PhpVersionFactory;
5556
use PHPStan\Php\PhpVersions;
5657
use PHPStan\PhpDoc\Tag\TemplateTag;
5758
use PHPStan\Reflection\Assertions;
@@ -6235,10 +6236,10 @@ public function getIterableValueType(Type $iteratee): Type
62356236

62366237
public function getPhpVersion(): PhpVersions
62376238
{
6238-
$minPhpVersion = IntegerRangeType::fromInterval(ConstantResolver::PHP_MIN_VERSION_ID, null);
6239+
$overallPhpVersionRange = IntegerRangeType::fromInterval(ConstantResolver::PHP_MIN_ANALYZABLE_VERSION_ID, PhpVersionFactory::MAX_PHP_VERSION);
62396240

62406241
$constType = $this->getGlobalConstantType(new Name('PHP_VERSION_ID'));
6241-
if ($constType !== null && !$constType->isSuperTypeOf($minPhpVersion)->yes()) {
6242+
if ($constType !== null && !$constType->equals($overallPhpVersionRange)) {
62426243
return new PhpVersions($constType);
62436244
}
62446245

0 commit comments

Comments
 (0)