Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Aug 26, 2024
1 parent b5d418c commit 7d85a3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/Php/PhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,6 @@ public function isCurloptUrlCheckingFileSchemeWithOpenBasedir(): bool
return $this->versionId < 80000;
}

public function hasExitAsFunction(): bool
{
return $this->versionId >= 80400;
}

public function highlightStringDoesNotReturnFalse(): bool
{
return $this->versionId >= 80400;
Expand Down
15 changes: 6 additions & 9 deletions src/Reflection/BetterReflection/BetterReflectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,8 @@ public function getFunction(Node\Name $nameNode, ?NamespaceAnswerer $namespaceAn
return $this->functionReflections[$lowerCasedFunctionName];
}

if ($this->phpVersion->hasExitAsFunction()) {
if (in_array($lowerCasedFunctionName, ['exit', 'die'], true)) {
return $this->functionReflections[$lowerCasedFunctionName] = new ExitFunctionReflection($lowerCasedFunctionName);
}
if (in_array($lowerCasedFunctionName, ['exit', 'die'], true)) {
return $this->functionReflections[$lowerCasedFunctionName] = new ExitFunctionReflection($lowerCasedFunctionName);
}

$nativeFunctionReflection = $this->nativeFunctionReflectionProvider->findFunctionReflection($lowerCasedFunctionName);
Expand Down Expand Up @@ -351,12 +349,11 @@ private function getCustomFunction(string $functionName): PhpFunctionReflection

public function resolveFunctionName(Node\Name $nameNode, ?NamespaceAnswerer $namespaceAnswerer): ?string
{
if ($this->phpVersion->hasExitAsFunction()) {
$name = $nameNode->toLowerString();
if (in_array($name, ['exit', 'die'], true)) {
return $name;
}
$name = $nameNode->toLowerString();
if (in_array($name, ['exit', 'die'], true)) {
return $name;
}

return $this->resolveName($nameNode, function (string $name): bool {
try {
$this->reflector->reflectFunction($name);
Expand Down

0 comments on commit 7d85a3a

Please sign in to comment.