File tree Expand file tree Collapse file tree
rules/TypedCollections/Rector/Property Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace Rector \Doctrine \TypedCollections \Rector \Property ;
66
7+ use PhpParser \Node \UnionType ;
8+ use PhpParser \Node \Name \FullyQualified ;
9+ use PhpParser \Node \Expr ;
710use Doctrine \Common \Collections \Collection ;
811use PhpParser \Node ;
912use PhpParser \Node \Name ;
@@ -94,15 +97,15 @@ public function refactor(Node $node): ?Class_
9497 }
9598
9699 // 2. handle native type
97- if ($ property ->type instanceof Node \ UnionType) {
100+ if ($ property ->type instanceof UnionType) {
98101 foreach ($ property ->type ->types as $ uniontedType ) {
99102 if ($ this ->isCollectionName ($ uniontedType )) {
100103 // narrow to pure collection
101- $ property ->type = new Name \ FullyQualified (DoctrineClass::COLLECTION );
104+ $ property ->type = new FullyQualified (DoctrineClass::COLLECTION );
102105 $ hasChanged = true ;
103106
104107 // remove default, as will be defined in constructor by another rule
105- if ($ property ->props [0 ]->default instanceof Node \ Expr) {
108+ if ($ property ->props [0 ]->default instanceof Expr) {
106109 $ property ->props [0 ]->default = null ;
107110 }
108111
You can’t perform that action at this time.
0 commit comments