Skip to content

Commit 68f21d0

Browse files
Simplify
1 parent 6787dd6 commit 68f21d0

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/Analyser/NodeScopeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,11 +2620,11 @@ private function createAstClassReflection(Node\Stmt\ClassLike $stmt, string $cla
26202620
throw new ShouldNotHappenException();
26212621
}
26222622

2623-
$enumAdapter = \PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum::class;
2624-
26252623
return $this->classReflectionFactory->create(
26262624
$betterReflectionClass->getName(),
2627-
$betterReflectionClass instanceof ReflectionEnum && PHP_VERSION_ID >= 80000 ? new $enumAdapter($betterReflectionClass) : new ReflectionClass($betterReflectionClass),
2625+
$betterReflectionClass instanceof ReflectionEnum && PHP_VERSION_ID >= 80000
2626+
? new \PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum($betterReflectionClass)
2627+
: new ReflectionClass($betterReflectionClass),
26282628
null,
26292629
null,
26302630
null,

src/Reflection/BetterReflection/BetterReflectionProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ public function getClass(string $className): ClassReflection
144144
}
145145

146146
if ($reflectionClass instanceof ReflectionEnum && PHP_VERSION_ID >= 80000) {
147-
$enumAdapter = \PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum::class;
148-
$adaptedClass = new $enumAdapter($reflectionClass);
147+
$adaptedClass = new \PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum($reflectionClass);
149148
} else {
150149
$adaptedClass = new ReflectionClass($reflectionClass);
151150
}

0 commit comments

Comments
 (0)