File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -33,15 +33,22 @@ public function resolve(mixed $subject, ?TypeContext $typeContext = null): Type
3333 $ identifier = $ subject ->getName ();
3434 $ nullable = $ subject ->allowsNull ();
3535
36+ /*
37+ * TODO: Workaround for a PHP bug where `PropertyType::getSettableType()`
38+ * returns types with the nullable question mark still included.
39+ */
40+ if (str_contains ($ identifier , '? ' )) {
41+ $ identifier = str_replace ('? ' , '' , $ identifier );
42+ $ nullable = true ;
43+ }
44+
3645 if (TypeIdentifier::ARRAY ->value === $ identifier ) {
3746 $ type = Type::array ();
38-
3947 return $ nullable ? Type::nullable ($ type ) : $ type ;
4048 }
4149
4250 if (TypeIdentifier::ITERABLE ->value === $ identifier ) {
4351 $ type = Type::iterable ();
44-
4552 return $ nullable ? Type::nullable ($ type ) : $ type ;
4653 }
4754
@@ -50,13 +57,7 @@ public function resolve(mixed $subject, ?TypeContext $typeContext = null): Type
5057 }
5158
5259 if ($ subject ->isBuiltin ()) {
53- if (str_contains ($ identifier , '? ' )) {
54- $ identifier = str_replace ('? ' , '' , $ identifier );
55- $ nullable = true ;
56- }
57-
5860 $ type = Type::builtin (TypeIdentifier::from ($ identifier ));
59-
6061 return $ nullable ? Type::nullable ($ type ) : $ type ;
6162 }
6263
You can’t perform that action at this time.
0 commit comments