@@ -43,10 +43,7 @@ public function load(string $className, array $options = [], array $context = []
43
43
44
44
foreach ($ result as &$ metadata ) {
45
45
$ type = $ metadata ->getType ();
46
-
47
- if (isset ($ variableTypes [(string ) $ type ])) {
48
- $ metadata = $ metadata ->withType ($ this ->replaceVariableTypes ($ type , $ variableTypes ));
49
- }
46
+ $ metadata = $ metadata ->withType ($ this ->replaceVariableTypes ($ type , $ variableTypes ));
50
47
}
51
48
52
49
return $ result ;
@@ -122,19 +119,19 @@ private function replaceVariableTypes(Type $type, array $variableTypes): Type
122
119
}
123
120
124
121
if ($ type instanceof UnionType) {
125
- return new UnionType (...array_map (fn (Type $ t ): Type => $ this ->replaceVariableTypes ($ t , $ variableTypes ), $ type ->getTypes ()));
122
+ return Type:: union (...array_map (fn (Type $ t ): Type => $ this ->replaceVariableTypes ($ t , $ variableTypes ), $ type ->getTypes ()));
126
123
}
127
124
128
125
if ($ type instanceof IntersectionType) {
129
- return new IntersectionType (...array_map (fn (Type $ t ): Type => $ this ->replaceVariableTypes ($ t , $ variableTypes ), $ type ->getTypes ()));
126
+ return Type:: intersection (...array_map (fn (Type $ t ): Type => $ this ->replaceVariableTypes ($ t , $ variableTypes ), $ type ->getTypes ()));
130
127
}
131
128
132
129
if ($ type instanceof CollectionType) {
133
130
return new CollectionType ($ this ->replaceVariableTypes ($ type ->getWrappedType (), $ variableTypes ), $ type ->isList ());
134
131
}
135
132
136
133
if ($ type instanceof GenericType) {
137
- return new GenericType (
134
+ return Type:: generic (
138
135
$ this ->replaceVariableTypes ($ type ->getWrappedType (), $ variableTypes ),
139
136
...array_map (fn (Type $ t ): Type => $ this ->replaceVariableTypes ($ t , $ variableTypes ), $ type ->getVariableTypes ()),
140
137
);
0 commit comments