Skip to content

support the match operator in constant expressions #9561

@claudepache

Description

@claudepache

Description

The following is supported (https://3v4l.org/gUPpH):

const FOO = PHP_INT_SIZE === 8 ? '64bit' : (PHP_INT_SIZE === 4 ? '32bit' : throw new \Error('unexpected'));

I’d like to write (https://3v4l.org/FRO6A):

const FOO = match (PHP_INT_SIZE) { 8 => '64bit', 4 => '32bit' };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions