44namespace Rector \CodeQuality \Rector \Class_ ;
55
66use PhpParser \Node ;
7- use PhpParser \Node \Attribute ;
87use PhpParser \Node \Expr ;
98use PhpParser \Node \Stmt \Class_ ;
109use PhpParser \Node \Stmt \ClassMethod ;
1615use Rector \BetterPhpDocParser \PhpDocManipulator \PhpDocTagRemover ;
1716use Rector \CodeQuality \NodeFactory \TypedPropertyFactory ;
1817use Rector \Comments \NodeDocBlock \DocBlockUpdater ;
19- use Rector \Doctrine \NodeAnalyzer \AttributeFinder ;
18+ use Rector \Php80 \NodeAnalyzer \PhpAttributeAnalyzer ;
2019use Rector \PhpParser \Node \Value \ValueResolver ;
2120use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
2221use Rector \Rector \AbstractRector ;
@@ -32,9 +31,9 @@ final class DynamicDocBlockPropertyToNativePropertyRector extends AbstractRector
3231{
3332 /**
3433 * @readonly
35- * @var \Rector\Doctrine \NodeAnalyzer\AttributeFinder
34+ * @var \Rector\Php80 \NodeAnalyzer\PhpAttributeAnalyzer
3635 */
37- private $ attributeFinder ;
36+ private $ phpAttributeAnalyzer ;
3837 /**
3938 * @readonly
4039 * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
@@ -65,9 +64,9 @@ final class DynamicDocBlockPropertyToNativePropertyRector extends AbstractRector
6564 * @var \Rector\PhpParser\Node\Value\ValueResolver
6665 */
6766 private $ valueResolver ;
68- public function __construct (AttributeFinder $ attributeFinder , PhpDocInfoFactory $ phpDocInfoFactory , PhpDocTagRemover $ phpDocTagRemover , DocBlockUpdater $ docBlockUpdater , TypedPropertyFactory $ typedPropertyFactory , TestsNodeAnalyzer $ testsNodeAnalyzer , ValueResolver $ valueResolver )
67+ public function __construct (PhpAttributeAnalyzer $ phpAttributeAnalyzer , PhpDocInfoFactory $ phpDocInfoFactory , PhpDocTagRemover $ phpDocTagRemover , DocBlockUpdater $ docBlockUpdater , TypedPropertyFactory $ typedPropertyFactory , TestsNodeAnalyzer $ testsNodeAnalyzer , ValueResolver $ valueResolver )
6968 {
70- $ this ->attributeFinder = $ attributeFinder ;
69+ $ this ->phpAttributeAnalyzer = $ phpAttributeAnalyzer ;
7170 $ this ->phpDocInfoFactory = $ phpDocInfoFactory ;
7271 $ this ->phpDocTagRemover = $ phpDocTagRemover ;
7372 $ this ->docBlockUpdater = $ docBlockUpdater ;
@@ -115,8 +114,7 @@ public function getNodeTypes() : array
115114 */
116115 public function refactor (Node $ node ) : ?Node
117116 {
118- $ allowDynamicPropertiesAttribute = $ this ->attributeFinder ->findAttributeByClass ($ node , 'AllowDynamicProperties ' );
119- if (!$ allowDynamicPropertiesAttribute instanceof Attribute) {
117+ if (!$ this ->phpAttributeAnalyzer ->hasPhpAttribute ($ node , 'AllowDynamicProperties ' )) {
120118 return null ;
121119 }
122120 if ($ this ->shouldSkipClass ($ node )) {
0 commit comments