You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NB 14 has support for the new features of php 8.1, but the enumeration support has a deficiency.
Enumerations cannot have properties (which is important as those are objects in the language implementation) although there is a use case, where an enumeration can have one, and only one readonly public property, called value.
…he#4066
- Fix the parser
- Add the `value` property to backed enums as CC items
- Add the members of `UnitEnum` and `BackedEnum` to enums as CC items
- Add unit tests
```php
Enums::CASE1->value;
Enums::from("name");
Enums::cases();
```
…he#4066
- Fix the parser
- Add the `value` property to backed enums as CC items
- Add the members of `UnitEnum` and `BackedEnum` to enums as CC items
- Add unit tests
```php
Enums::CASE1->value;
Enums::from("name");
Enums::cases();
```
Description
NB 14 has support for the new features of php 8.1, but the enumeration support has a deficiency.
Enumerations cannot have properties (which is important as those are objects in the language implementation) although there is a use case, where an enumeration can have one, and only one readonly public property, called value.
This property is populated when backed enumerations are used.
Use case/motivation
Right now NB shows an error when a property on an enumeration is accessed. The error is context dependant, an example code is below:
In the example below, after every
->value
there's a Syntax error, because the checker expects a method call. So in this case line 21. shows an error:Related issues
No response
Are you willing to submit a PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: