File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
rules/TypedCollections/Rector/Property Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Rector \Doctrine \TypedCollections \Rector \Property ;
6
6
7
+ use PhpParser \Node \UnionType ;
8
+ use PhpParser \Node \Name \FullyQualified ;
9
+ use PhpParser \Node \Expr ;
7
10
use Doctrine \Common \Collections \Collection ;
8
11
use PhpParser \Node ;
9
12
use PhpParser \Node \Name ;
@@ -94,15 +97,15 @@ public function refactor(Node $node): ?Class_
94
97
}
95
98
96
99
// 2. handle native type
97
- if ($ property ->type instanceof Node \ UnionType) {
100
+ if ($ property ->type instanceof UnionType) {
98
101
foreach ($ property ->type ->types as $ uniontedType ) {
99
102
if ($ this ->isCollectionName ($ uniontedType )) {
100
103
// narrow to pure collection
101
- $ property ->type = new Name \ FullyQualified (DoctrineClass::COLLECTION );
104
+ $ property ->type = new FullyQualified (DoctrineClass::COLLECTION );
102
105
$ hasChanged = true ;
103
106
104
107
// 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) {
106
109
$ property ->props [0 ]->default = null ;
107
110
}
108
111
You can’t perform that action at this time.
0 commit comments