Skip to content

Enums for Protobuf PHP? #15567

@bshaffer

Description

@bshaffer

PHP 8.1 brought us Enumerations, which are absolutely perfect for use in Protobuf. Specifically, backed Enumerations would bring us exactly what we want:

enum Status: int
{
    case STATUS_UNDEFINED = 0;
    case ACTIVE = 1;
    case INACTIVE = 2;
}

Now that this library supports a minimum of PHP 8.1, would the protobuf team entertain a change like this? We would want to put it behind an option, so as to prevent breaking changes.

Metadata

Metadata

Assignees

Labels

inactiveDenotes the issue/PR has not seen activity in the last 90 days.php

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions