Skip to content

Commit

Permalink
PHPMD
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Aug 9, 2024
1 parent 361bc3c commit 1569553
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Carbon/PHPStan/MacroExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
{
$macros = FactoryImmutable::getDefaultInstance()->getSettings()['macros'] ?? [];
$macro = $macros[$methodName] ?? throw new InvalidArgumentException("Macro '$methodName' not found");
$static = false;
$final = false;
$deprecated = false;
$docComment = null;

if (\is_array($macro) && \count($macro) === 2 && \is_string($macro[1])) {
\assert($macro[1] !== '');
Expand All @@ -97,8 +101,6 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
} elseif (\is_string($macro)) {
$reflection = new ReflectionFunction($macro);
$closure = $reflection->getClosure();
$static = false;
$final = false;
$deprecated = $reflection->isDeprecated();
$docComment = $reflection->getDocComment() ?: null;
} elseif ($macro instanceof Closure) {
Expand All @@ -110,7 +112,6 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
} catch (Throwable) {
$static = true;
}
$final = false;

$reflection = new ReflectionFunction($macro);
$deprecated = $reflection->isDeprecated();
Expand Down

0 comments on commit 1569553

Please sign in to comment.