Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP] Add support for Enum #3004

Merged
merged 4 commits into from Feb 18, 2021
Merged

[PHP] Add support for Enum #3004

merged 4 commits into from Feb 18, 2021

Conversation

Ayesh
Copy link
Contributor

@Ayesh Ayesh commented Feb 14, 2021

Related to #2997.

PHP 8.1 will add support for Enums with a syntax similar to this:

enum Foo: string {}

At the moment, the vote has two more days to end, but it already has the 2/3 majority it requires to pass. This PR includes changes that did not make it to #2997 because the vote has yet to end. Once the vote is concluded, I will mark mark this PR ready for review, although early reviews are received with so much gratitude!

Changes

  • Add Enum syntax support as a class-name variant.
  • Update CHANGES.md file.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md
  • Added myself to AUTHORS.txt, under Contributors

Ayesh and others added 3 commits February 15, 2021 00:45
PHP 8.1 adds support for Enums with [`enum` syntax](https://php.watch/versions/8.1/enums#enum-syntax).

Adding `enum` keyword to class naming pattern matches, and relaxing the class structure matching to allow `:` character to support Backed-Enum syntax.
Brilliant suggestion by @joshgoebel to use variants with different `illegal` matching patterns. Enums can contain a colon, but not other class-like structs such as `trait`, `interface`, and `class`.

Co-authored-by: Josh Goebel <me@joshgoebel.com>
@Ayesh Ayesh marked this pull request as ready for review February 18, 2021 08:45
@Ayesh
Copy link
Contributor Author

Ayesh commented Feb 18, 2021

RFC vote ended with 44:7 in favor. PHP 8.1 will have Enums 🎉🎊.

@joshgoebel joshgoebel merged commit 2b6a9e9 into highlightjs:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants