Open mattjanssen opened 4 years ago
The TypeTokenFactory could be fixed and enhanced to support PHP typed properties.
TypeTokenFactory
The following currently throws an exception if it encounters a non-initialized typed property:
$property->getDeclaringClass()->getDefaultProperties()[$property->getName()];
See https://3v4l.org/gVdKO to illustrate why this happens. An easy fix would be to add ?? null to the end.
?? null
Somewhere in this chain of guessing the property's type could be a check for the property type:
$propertyAsTyped = $property->getType()->getName();
Obviously it would need a PHP version check around execution, and a null check in case it's not typed.
The
TypeTokenFactory
could be fixed and enhanced to support PHP typed properties.Fix:
The following currently throws an exception if it encounters a non-initialized typed property:
See https://3v4l.org/gVdKO to illustrate why this happens. An easy fix would be to add
?? null
to the end.Enhancement:
Somewhere in this chain of guessing the property's type could be a check for the property type:
Obviously it would need a PHP version check around execution, and a null check in case it's not typed.