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 8.0 | Tokenizer/PHP: bugfix for union types using namespace operator #3302

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Apr 20, 2021

Type declarations can use namespace relative Types, i.e. namespace\Sub\Name.

However, in that case, the T_BITWISE_OR token was incorrectly not converted to T_TYPE_UNION.

Includes unit tests.
Includes additional tests with all other "namespaced identifier name" types to safeguard this for the PHPCS 4.x change to the PHP 8.0 tokenization of identifier names.

Note: the tests should be forward-ported to the 4.x branch. The change to the Tokenizer/PHP file should not.

Type declarations can use namespace relative Types, i.e. `namespace\Sub\Name`.

However, in that case, the `T_BITWISE_OR` token was incorrectly not converted to `T_TYPE_UNION`.

Includes unit tests.
Includes additional tests with all other "namespaced identifier name" types to safeguard this for the PHPCS 4.x change to the PHP 8.0 tokenization of identifier names.
@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Apr 23, 2021
@gsherwood gsherwood added this to the 3.6.1 milestone Apr 23, 2021
gsherwood added a commit that referenced this pull request Apr 23, 2021
@gsherwood gsherwood merged commit 4eeb4dd into squizlabs:master Apr 23, 2021
PHPCS v3 Development automation moved this from Idea Bank to Ready for Release Apr 23, 2021
@gsherwood
Copy link
Member

Thanks for finding and fixing this. Merged into 4.0 as per instructions and all went well.

@jrfnl jrfnl deleted the feature/tokenizer-php-bugfix-namespaced-type-decl-vs-union-types branch April 23, 2021 04:39
@jrfnl jrfnl mentioned this pull request Nov 20, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PHPCS v3 Development
Ready for Release
Development

Successfully merging this pull request may close these issues.

None yet

2 participants