6262use PHPStan \BetterReflection \Reflector \Reflector ;
6363use PHPStan \BetterReflection \SourceLocator \Ast \Strategy \NodeToReflection ;
6464use PHPStan \BetterReflection \SourceLocator \Located \LocatedSource ;
65+ use PHPStan \DependencyInjection \AutowiredParameter ;
66+ use PHPStan \DependencyInjection \AutowiredService ;
6567use PHPStan \DependencyInjection \Reflection \ClassReflectionExtensionRegistryProvider ;
6668use PHPStan \DependencyInjection \Type \DynamicThrowTypeExtensionProvider ;
6769use PHPStan \DependencyInjection \Type \ParameterClosureTypeExtensionProvider ;
223225use const PHP_VERSION_ID ;
224226use const SORT_NUMERIC ;
225227
228+ #[AutowiredService]
226229final class NodeScopeResolver
227230{
228231
@@ -249,9 +252,11 @@ final class NodeScopeResolver
249252 public function __construct (
250253 private readonly ReflectionProvider $ reflectionProvider ,
251254 private readonly InitializerExprTypeResolver $ initializerExprTypeResolver ,
255+ #[AutowiredParameter(ref: '@nodeScopeResolverReflector ' )]
252256 private readonly Reflector $ reflector ,
253257 private readonly ClassReflectionExtensionRegistryProvider $ classReflectionExtensionRegistryProvider ,
254258 private readonly ParameterOutTypeExtensionProvider $ parameterOutTypeExtensionProvider ,
259+ #[AutowiredParameter(ref: '@defaultAnalysisParser ' )]
255260 private readonly Parser $ parser ,
256261 private readonly FileTypeMapper $ fileTypeMapper ,
257262 private readonly StubPhpDocProvider $ stubPhpDocProvider ,
@@ -266,15 +271,23 @@ public function __construct(
266271 private readonly ReadWritePropertiesExtensionProvider $ readWritePropertiesExtensionProvider ,
267272 private readonly ParameterClosureTypeExtensionProvider $ parameterClosureTypeExtensionProvider ,
268273 private readonly ScopeFactory $ scopeFactory ,
274+ #[AutowiredParameter]
269275 private readonly bool $ polluteScopeWithLoopInitialAssignments ,
276+ #[AutowiredParameter]
270277 private readonly bool $ polluteScopeWithAlwaysIterableForeach ,
278+ #[AutowiredParameter]
271279 private readonly bool $ polluteScopeWithBlock ,
280+ #[AutowiredParameter]
272281 private readonly array $ earlyTerminatingMethodCalls ,
282+ #[AutowiredParameter]
273283 private readonly array $ earlyTerminatingFunctionCalls ,
284+ #[AutowiredParameter]
274285 private readonly array $ universalObjectCratesClasses ,
286+ #[AutowiredParameter(ref: '%exceptions.implicitThrows% ' )]
275287 private readonly bool $ implicitThrows ,
288+ #[AutowiredParameter]
276289 private readonly bool $ treatPhpDocTypesAsCertain ,
277- private readonly bool $ narrowMethodScopeFromConstructor ,
290+ private readonly bool $ narrowMethodScopeFromConstructor = true ,
278291 )
279292 {
280293 $ earlyTerminatingMethodNames = [];
0 commit comments