|
22 | 22 | use PHPStan\BetterReflection\Reflector\Reflector; |
23 | 23 | use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; |
24 | 24 | use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; |
| 25 | +use PHPStan\DependencyInjection\AutowiredExtensions; |
25 | 26 | use PHPStan\DependencyInjection\AutowiredService; |
| 27 | +use PHPStan\DependencyInjection\ExtensionsCollection; |
26 | 28 | use PHPStan\File\FileReader; |
27 | 29 | use PHPStan\Node\ClassConstantsNode; |
28 | 30 | use PHPStan\Node\ClassMethodsNode; |
|
32 | 34 | use PHPStan\Reflection\ClassReflection; |
33 | 35 | use PHPStan\Reflection\ClassReflectionFactory; |
34 | 36 | use PHPStan\Reflection\ReflectionProvider; |
| 37 | +use PHPStan\Rules\Properties\ReadWritePropertiesExtension; |
35 | 38 | use PHPStan\ShouldNotHappenException; |
36 | 39 | use function sprintf; |
37 | 40 | use function usort; |
|
46 | 49 | final class ClassLikeHandler implements StmtHandler |
47 | 50 | { |
48 | 51 |
|
| 52 | + /** |
| 53 | + * @param ExtensionsCollection<ReadWritePropertiesExtension> $readWritePropertiesExtensions |
| 54 | + */ |
49 | 55 | public function __construct( |
50 | 56 | private Reflector $reflector, |
51 | 57 | private ClassReflectionFactory $classReflectionFactory, |
52 | 58 | private CalledMethodProcessor $calledMethodProcessor, |
53 | 59 | private ReflectionProvider $reflectionProvider, |
54 | 60 | private AttributesHandler $attributesHandler, |
| 61 | + #[AutowiredExtensions(of: ReadWritePropertiesExtension::class)] |
| 62 | + private ExtensionsCollection $readWritePropertiesExtensions, |
55 | 63 | ) |
56 | 64 | { |
57 | 65 | } |
@@ -129,7 +137,7 @@ public function processStmt( |
129 | 137 | // Class members have their own inference context, including when the class |
130 | 138 | // declaration is visited during an enclosing body's observation pass. |
131 | 139 | $nodeScopeResolver->processStmtNodesInternal($stmt, $classLikeStatements, $classScope, $storage, $classStatementsGatherer, StatementContext::createTopLevel()); |
132 | | - $nodeScopeResolver->callNodeCallback($nodeCallback, new ClassPropertiesNode($stmt, $nodeScopeResolver->getReadWritePropertiesExtensions(), $classStatementsGatherer->getProperties(), $classStatementsGatherer->getPropertyUsages(), $classStatementsGatherer->getMethodCalls(), $classStatementsGatherer->getReturnStatementsNodes(), $classStatementsGatherer->getPropertyAssigns(), $classReflection), $classScope, $storage); |
| 140 | + $nodeScopeResolver->callNodeCallback($nodeCallback, new ClassPropertiesNode($stmt, $this->readWritePropertiesExtensions, $classStatementsGatherer->getProperties(), $classStatementsGatherer->getPropertyUsages(), $classStatementsGatherer->getMethodCalls(), $classStatementsGatherer->getReturnStatementsNodes(), $classStatementsGatherer->getPropertyAssigns(), $classReflection), $classScope, $storage); |
133 | 141 | $nodeScopeResolver->callNodeCallback($nodeCallback, new ClassMethodsNode($stmt, $classStatementsGatherer->getMethods(), $classStatementsGatherer->getMethodCalls(), $classReflection), $classScope, $storage); |
134 | 142 | $nodeScopeResolver->callNodeCallback($nodeCallback, new ClassConstantsNode($stmt, $classStatementsGatherer->getConstants(), $classStatementsGatherer->getConstantFetches(), $classReflection), $classScope, $storage); |
135 | 143 | $classReflection->evictPrivateSymbols(); |
|
0 commit comments