PHP 8.0/8.1 | ForbiddenNames: detect use of new keywords when used as names by jrfnl · Pull Request #1415 · PHPCompatibility/PHPCompatibility
Navigation Menu
{{ message }}
PHPCompatibility / PHPCompatibility Public
- Notifications You must be signed in to change notification settings
- Fork 204
Merged
Conversation
Copy link Copy Markdown
Member
jrfnl
commented
Dec 4, 2022
jrfnl
commented
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
- Allow using readonly as function name php/php-src#7468 (readonly exception in PHP 8.1)
- Fix syntax error when using readonly with dnf php/php-src#9512 (readonly exception PHP 8.2 follow-up)
… 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
added
Type: enhancement
PR: quick merge
PR: ready for review labels
Dec 4, 2022
jrfnl
added this to the
10.0.0 milestone
jrfnl
requested a review
from wimg
wimg approved these changes Dec 4, 2022
wimg
enabled auto-merge
wimg
merged commit
fa86d72
into
develop
wimg
deleted the
php-8.0-8.1/forbiddennames-add-new-keywords
branch
jrfnl
removed
PR: quick merge
PR: ready for review labels
Dec 7, 2022
jrfnl
mentioned this pull request
47 tasks
jrfnl
mentioned this pull request
40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment