Skip to content

Commit 536ebda

Browse files
committed
Expand the PHP 8.4 thingy fix.
1 parent e86e4cc commit 536ebda

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/TypeExtractor/EntityTypeResolver.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)