[ 
https://issues.apache.org/jira/browse/NETBEANS-5599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530784#comment-17530784
 ] 

Ádám Turcsán edited comment on NETBEANS-5599 at 5/2/22 3:30 PM:
----------------------------------------------------------------

[~junichi11] I'm testing 14-rc2 and enumerations have a missing implementation. 
Enumerations cannot have porperties, but there's a special case, called backed 
enumeration, where they have one, and only one readonly property, called 
{_}value{_}:
[https://www.php.net/manual/en/language.enumerations.backed.php]

It is not handled yet. An example, where line 21. shows an error:
Syntax error:
    unexpected: ,
    expected: (
{code: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
        };
    }
}
{code}
Everything is A Okay, thank you for your work!


was (Author: lwjunior):
[~junichi11] I'm testing 14-rc2 and enumerations have a missing implementation. 
Enumerations cannot have porperties, but there's a special case, called backed 
enumeration, where they have one, and only one readonly property, called 
{_}value{_}:
[https://www.php.net/manual/en/language.enumerations.backed.php]

It is not handled yet. An example, where line 21. show error:
Syntax error:
    unexpected: ,
    expected: (
{code: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
        };
    }
}
{code}
Everything is A Okay, thank you for your work!

> PHP 8.1 Support
> ---------------
>
>                 Key: NETBEANS-5599
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-5599
>             Project: NetBeans
>          Issue Type: New Feature
>          Components: php - Editor
>            Reporter: Junichi Yamamoto
>            Assignee: Junichi Yamamoto
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 11h
>  Remaining Estimate: 0h
>
> [https://wiki.php.net/rfc#php_81]
>  * [https://wiki.php.net/rfc/final_class_const]
>  * [https://wiki.php.net/rfc/noreturn_type]
>  * [https://wiki.php.net/rfc/readonly_properties_v2]
>  * [https://wiki.php.net/rfc/new_in_initializers]
>  * [https://wiki.php.net/rfc/pure-intersection-types]
>  * [https://wiki.php.net/rfc/enumerations]
>  * [https://wiki.php.net/rfc/first_class_callable_syntax]
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to