-
-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
Hi,
When i want to resolve a variable type, there is a little bug when it begin with ?
: it should return a Compound
object, but it return a Nullable
object, with Compound
as realType. As you can see in example below, in ?string|null|?boolean
, ?boolean
is well parsed, cause it's not the first one.
$typeResolver = new TypeResolver();
print_r($typeResolver->resolve('?string|null|?boolean'));
phpDocumentor\Reflection\Types\Nullable Object
(
[realType:phpDocumentor\Reflection\Types\Nullable:private] => phpDocumentor\Reflection\Types\Compound Object
(
[types:phpDocumentor\Reflection\Types\Compound:private] => Array
(
[0] => phpDocumentor\Reflection\Types\String_ Object
(
)
[1] => phpDocumentor\Reflection\Types\Null_ Object
(
)
[2] => phpDocumentor\Reflection\Types\Nullable Object
(
[realType:phpDocumentor\Reflection\Types\Nullable:private] => phpDocumentor\Reflection\Types\Boolean Object
(
)
)
)
)
)
Another example, that works well, without ?
as first character:
$typeResolver = new TypeResolver();
print_r($typeResolver->resolve('string|null|?boolean'));
phpDocumentor\Reflection\Types\Compound Object
(
[types:phpDocumentor\Reflection\Types\Compound:private] => Array
(
[0] => phpDocumentor\Reflection\Types\String_ Object
(
)
[1] => phpDocumentor\Reflection\Types\Null_ Object
(
)
[2] => phpDocumentor\Reflection\Types\Nullable Object
(
[realType:phpDocumentor\Reflection\Types\Nullable:private] => phpDocumentor\Reflection\Types\Boolean Object
(
)
)
)
)
Metadata
Metadata
Assignees
Labels
No labels