We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum values are objects. So in normalizeValue they end up in throw new \LogicException('Invalid value').
normalizeValue
throw new \LogicException('Invalid value')
Something like this code could be added at the end of the method to handle enum values as well:
if (is_object($defaultValue)) { $className = get_class($defaultValue); $isEnum = function_exists('enum_exists') && enum_exists($className, false); if ($isEnum) { return new Node\Expr\ClassConstFetch( new FullyQualified($className), new Node\Identifier($defaultValue->name) )); } }
Maybe there are other cases that need handling, but I'm not sure if we can go from "object value" to "Expr" safely for them too.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Enum values are objects. So in
normalizeValue
they end up inthrow new \LogicException('Invalid value')
.Something like this code could be added at the end of the method to handle enum values as well:
Maybe there are other cases that need handling, but I'm not sure if we can go from "object value" to "Expr" safely for them too.
The text was updated successfully, but these errors were encountered: