Skip to content

Commit b85cce6

Browse files
committed
More #[AutowiredService]
1 parent 9a10fa3 commit b85cce6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

conf/services.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,6 @@ services:
252252

253253
# Reflection providers
254254

255-
betterReflectionReflector:
256-
class: PHPStan\Reflection\BetterReflection\Reflector\MemoizingReflector
257-
arguments:
258-
reflector: @originalBetterReflectionReflector
259-
autowired: PHPStan\BetterReflection\Reflector\Reflector
260-
261255
betterReflectionProvider:
262256
class: PHPStan\Reflection\BetterReflection\BetterReflectionProvider
263257
arguments:

src/Reflection/BetterReflection/Reflector/MemoizingReflector.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
use PHPStan\BetterReflection\Reflection\ReflectionFunction;
1111
use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
1212
use PHPStan\BetterReflection\Reflector\Reflector;
13+
use PHPStan\DependencyInjection\AutowiredParameter;
14+
use PHPStan\DependencyInjection\AutowiredService;
1315
use function array_key_exists;
1416
use function strtolower;
1517

18+
#[AutowiredService(name: 'betterReflectionReflector', as: Reflector::class)]
1619
final class MemoizingReflector implements Reflector
1720
{
1821

@@ -25,7 +28,10 @@ final class MemoizingReflector implements Reflector
2528
/** @var array<string, ReflectionFunction|null> */
2629
private array $functionReflections = [];
2730

28-
public function __construct(private Reflector $reflector)
31+
public function __construct(
32+
#[AutowiredParameter(ref: '@originalBetterReflectionReflector')]
33+
private Reflector $reflector,
34+
)
2935
{
3036
}
3137

0 commit comments

Comments
 (0)