Closed hctorres02 closed 1 year ago
It looks like this issue is fixed in PHP 8.2 https://wiki.php.net/rfc/fetch_property_in_const_expressions
I'll merge in for supporting earlier PHP versions as well as provide flexibility beyond Enums.
Thanks @hctorres02 🙌
When using enums as array keys in the properties, PHP throws a syntax error, as the interpretation is considered to be dynamic. To work around this, if the values are inside a method, they will be interpreted as part of the invocation.
The method will take precedence over the property.
Before:
After: