Skip to content

Commit

Permalink
Scope: fix getPhpVersion() in non-namespaced files
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 20, 2024
1 parent c5df243 commit 92ad9d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -5728,15 +5728,15 @@ public function getIterableValueType(Type $iteratee): Type

public function getPhpVersion(): PhpVersions
{
$versionExpr = new ConstFetch(new Name('PHP_VERSION_ID'));
if (!$this->hasExpressionType($versionExpr)->yes()) {
$name = new Name('PHP_VERSION_ID');
if (!$this->hasConstant($name)) {
if (is_array($this->configPhpVersion)) {
return new PhpVersions(IntegerRangeType::fromInterval($this->configPhpVersion['min'], $this->configPhpVersion['max']));
}
return new PhpVersions(new ConstantIntegerType($this->phpVersion->getVersionId()));
}

return new PhpVersions($this->getType($versionExpr));
return new PhpVersions($this->getType(new ConstFetch($name)));
}

}

0 comments on commit 92ad9d2

Please sign in to comment.