You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/05/03 06:42:11 UTC
[GitHub] [netbeans] adamturcsan opened a new issue, #4066: PHP 8.2 backed enumerations implementation
adamturcsan opened a new issue, #4066:
URL: https://github.com/apache/netbeans/issues/4066
### Description
NB 14 has support for the new features of php 8.2, 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](https://www.php.net/manual/en/language.enumerations.backed.php) 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:
```php
<?php
use DateTimeImmutable;
use DateTimeZone;
enum StopDay: string
{
case WEEKDAYS = 'weekdays';
case WEEKEND = 'weekend';
case MONDAY = 'Mon';
case TUESDAY = 'Tue';
case WEDNESDAY = 'Wed';
case THURSDAY = 'Thu';
case FRIDAY = 'Fri';
case SATURDAY = 'Sat';
case SUNDAY = 'Sun';
public function isToday(DateTimeImmutable $date = new DateTimeImmutable('now', new DateTimeZone('UTC'))): bool
{
return match($this) {
self::MONDAY => $date->format('D') === self::MONDAY->value,
self::TUESDAY => $date->format('D') === self::TUESDAY->value,
self::WEDNESDAY => $date->format('D') === self::WEDNESDAY->value,
self::THURSDAY => $date->format('D') === self::THURSDAY->value,
self::FRIDAY => $date->format('D') === self::FRIDAY->value,
self::SATURDAY => $date->format('D') === self::SATURDAY->value,
self::SUNDAY => $date->format('D') === self::SUNDAY->value,
self::WEEKDAYS => $date->format('D') !== self::SATURDAY->value && $date->format('D') !== self::SUNDAY->value,
self::WEEKEND => $date->format('D') === self::SATURDAY->value || $date->format('D') === self::SUNDAY->value
};
}
}
```
In the example below, after every `->value` there's a Syntax error, because the checker expect a method call. So in this case line 21. shows an error:
```
Syntax error:
unexpected: ,
expected: (
```
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] tmysik closed issue #4066: PHP 8.1 backed enumerations implementation
Posted by GitBox <gi...@apache.org>.
tmysik closed issue #4066: PHP 8.1 backed enumerations implementation
URL: https://github.com/apache/netbeans/issues/4066
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists