PHP 8.0/8.1 | ForbiddenNames: detect use of new keywords when used as names by jrfnl · Pull Request #1415 · PHPCompatibility/PHPCompatibility

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@jrfnl

Copy link Copy Markdown

Member

@jrfnl jrfnl commented

Dec 4, 2022

PHP 8.0 introduced match as a new reserved keyword and mixed as a new "other" reserved keyword. PHP 8.1 introduced readonly as a new reserved keyword, never as an "other" reserved keyword and enum as a soft reserved keyword.

Note: readonly has an exception for when it is used as a function declaration name.

Includes regenerated test case files.

Refs:

… names

PHP 8.0 introduced `match` as a new reserved keyword and `mixed` as a new "other" reserved keyword.
PHP 8.1 introduced `readonly` as a new reserved keyword, `never` as an "other" reserved keyword and `enum` as a soft reserved keyword.

Note: `readonly` has an exception for when it is used as a function declaration name.

Includes regenerated test case files.

Refs:
* https://wiki.php.net/rfc/match_expression_v2
* https://wiki.php.net/rfc/mixed_type_v2#backward_incompatible_changes
* https://wiki.php.net/rfc/readonly_properties_v2
* https://wiki.php.net/rfc/enumerations
* https://wiki.php.net/rfc/noreturn_type#backwards_incompatible_changes
* php/php-src#7468 (readonly exception in PHP 8.1)
* php/php-src#9512 (readonly exception PHP 8.2 follow-up)

@jrfnl jrfnl added Type: enhancement PR: quick merge

PR only contains relatively simple changes

PR: ready for review labels

Dec 4, 2022

@jrfnl jrfnl added this to the 10.0.0 milestone

Dec 4, 2022

@jrfnl jrfnl requested a review from wimg

December 4, 2022 19:44

@wimg wimg enabled auto-merge

December 4, 2022 19:48

@wimg wimg merged commit fa86d72 into develop

Dec 4, 2022

@wimg wimg deleted the php-8.0-8.1/forbiddennames-add-new-keywords branch

December 4, 2022 20:00

@jrfnl jrfnl removed PR: quick merge

PR only contains relatively simple changes

PR: ready for review labels

Dec 7, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@wimg wimg wimg approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

10.0.0-alpha1

Development

Successfully merging this pull request may close these issues.

2 participants

@jrfnl @wimg