Skip to content

Commit c064916

Browse files
committed
fix
1 parent 0da3135 commit c064916

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Analyser/MutatingScope.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5727,15 +5727,17 @@ public function getIterableValueType(Type $iteratee): Type
57275727

57285728
public function getPhpVersion(): PhpVersions
57295729
{
5730-
$name = new Name('PHP_VERSION_ID');
5731-
if (!$this->hasConstant($name)) {
5732-
if (is_array($this->configPhpVersion)) {
5733-
return new PhpVersions(IntegerRangeType::fromInterval($this->configPhpVersion['min'], $this->configPhpVersion['max']));
5730+
foreach (['PHP_VERSION_ID', '\\PHP_VERSION_ID'] as $constName) {
5731+
$versionExpr = new ConstFetch(new Name($constName));
5732+
if ($this->hasExpressionType($versionExpr)->yes()) {
5733+
return new PhpVersions($this->getType($versionExpr));
57345734
}
5735-
return new PhpVersions(new ConstantIntegerType($this->phpVersion->getVersionId()));
57365735
}
57375736

5738-
return new PhpVersions($this->getType(new ConstFetch($name)));
5737+
if (is_array($this->configPhpVersion)) {
5738+
return new PhpVersions(IntegerRangeType::fromInterval($this->configPhpVersion['min'], $this->configPhpVersion['max']));
5739+
}
5740+
return new PhpVersions(new ConstantIntegerType($this->phpVersion->getVersionId()));
57395741
}
57405742

57415743
}

0 commit comments

Comments
 (0)