From 7d85a3aabd641f4d7d8295a7006cdaca478931c7 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 26 Aug 2024 23:58:19 +0200 Subject: [PATCH] Fix --- src/Php/PhpVersion.php | 5 ----- .../BetterReflection/BetterReflectionProvider.php | 15 ++++++--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Php/PhpVersion.php b/src/Php/PhpVersion.php index ff3f1966e..817316d16 100644 --- a/src/Php/PhpVersion.php +++ b/src/Php/PhpVersion.php @@ -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; diff --git a/src/Reflection/BetterReflection/BetterReflectionProvider.php b/src/Reflection/BetterReflection/BetterReflectionProvider.php index b25b7b1e0..6ae28ec9c 100644 --- a/src/Reflection/BetterReflection/BetterReflectionProvider.php +++ b/src/Reflection/BetterReflection/BetterReflectionProvider.php @@ -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); @@ -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);