Skip to content

Commit 9dac9b4

Browse files
committed
fix
1 parent b46b740 commit 9dac9b4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Analyser/ConstantResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
final class ConstantResolver
3535
{
3636

37+
public const int PHP_MIN_VERSION_ID = 50207;
38+
3739
/** @var array<string, true> */
3840
private array $currentlyResolving = [];
3941

@@ -141,7 +143,7 @@ public function resolvePredefinedConstant(string $resolvedConstantName): ?Type
141143
return $this->createInteger($minRelease, $maxRelease);
142144
}
143145
if ($resolvedConstantName === 'PHP_VERSION_ID') {
144-
$minVersion = 50207;
146+
$minVersion = self::PHP_MIN_VERSION_ID;
145147
$maxVersion = null;
146148
if ($minPhpVersion !== null) {
147149
$minVersion = max($minVersion, $minPhpVersion->getVersionId());

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6235,8 +6235,10 @@ public function getIterableValueType(Type $iteratee): Type
62356235

62366236
public function getPhpVersion(): PhpVersions
62376237
{
6238+
$minPhpVersion = IntegerRangeType::fromInterval(ConstantResolver::PHP_MIN_VERSION_ID, null);
6239+
62386240
$constType = $this->getGlobalConstantType(new Name('PHP_VERSION_ID'));
6239-
if ($constType !== null) {
6241+
if ($constType !== null && !$minPhpVersion->isSuperTypeOf($constType)->yes()) {
62406242
return new PhpVersions($constType);
62416243
}
62426244

0 commit comments

Comments
 (0)