File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -86,3 +86,8 @@ services:
86
86
class : PHPStan\Type\Nette\FormContainerValuesDynamicReturnTypeExtension
87
87
tags :
88
88
- phpstan.broker.dynamicMethodReturnTypeExtension
89
+
90
+ -
91
+ class : PHPStan\Rule\Nette\PresenterInjectedPropertiesExtension
92
+ tags :
93
+ - phpstan.properties.readWriteExtension
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace PHPStan \Rule \Nette ;
4
+
5
+ use PHPStan \Reflection \PropertyReflection ;
6
+ use PHPStan \Rules \Properties \ReadWritePropertiesExtension ;
7
+
8
+ class PresenterInjectedPropertiesExtension implements ReadWritePropertiesExtension
9
+ {
10
+
11
+ public function isAlwaysRead (PropertyReflection $ property , string $ propertyName ): bool
12
+ {
13
+ return false ;
14
+ }
15
+
16
+ public function isAlwaysWritten (PropertyReflection $ property , string $ propertyName ): bool
17
+ {
18
+ return false ;
19
+ }
20
+
21
+ public function isInitialized (PropertyReflection $ property , string $ propertyName ): bool
22
+ {
23
+ return $ property ->isPublic () &&
24
+ $ property ->getDeclaringClass ()->isSubclassOf ('Nette\Application\UI\Presenter ' ) &&
25
+ strpos ($ property ->getDocComment () ?? '' , '@inject ' ) !== false ;
26
+ }
27
+
28
+ }
You can’t perform that action at this time.
0 commit comments