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 | Union types - sync with PHPCS #225

Merged
merged 7 commits into from
Nov 3, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 3, 2020

Related to upstream PR squizlabs/PHP_CodeSniffer#3032 which was merged yesterday and will be included in PHPCS 3.6.0.

Commit details

Collections::parameterTypeTokens(): add T_TYPE_UNION token

Upstream PR 3032 introduces a new T_TYPE_UNION token for the | in union types.

This token is now included in the Collections::parameterTypeTokens() method and by extension in the Collections::parameterTypeTokensBC() method if the PHPCS version allows for it.

Includes updated unit test.

Collections::propertyTypeTokens(): add T_TYPE_UNION token

Upstream PR 3032 introduces a new T_TYPE_UNION token for the | in union types.

This token is now included in the Collections::propertyTypeTokens() method and by extension in the Collections::propertyTypeTokensBC() method if the PHPCS version allows for it.

Includes updated unit test.

Collections::returnTypeTokens(): add T_TYPE_UNION token

Upstream PR 3032 introduces a new T_TYPE_UNION token for the | in union types.

This token is now included in the Collections::returnTypeTokens() method and by extension in the Collections::returnTypeTokensBC() method if the PHPCS version allows for it.

Includes updated unit test.

BCFile::getMethodParameters(): sync with PHPCS / union type support

PR #168 added support for union types to the FunctionDeclarations::getParameters() method.

Upstream PR 3032 added the same to the PHPCS native File::getMethodParameters() method.

As that PR has now been merged, this commit syncs the upstream changes into the BCFile::getMethodParameters() method, moves the unit tests to the BCFile test class and makes a minor change to the FunctionDeclarations::getParameters() method to support the changes as have been merged upstream.

BCFile::getMethodProperties(): sync with PHPCS / union type support

PR #168 added support for union types to the FunctionDeclarations::getProperties() method and by extension the BCFile::getMethodProperties() method, even though PHPCS upstream did not support union types yet.

Upstream PR 3032 added support for union types to the PHPCS native File::getMethodProperties() method.

As that PR has now been merged, this commit syncs the upstream changes in, by moving the unit tests from the "Diff" tests to the BCFile tests and annotating that union types are now officially supported in the BCFile::getMethodProperties() method.

BCFile::getMethodProperties(): fix compatibility with PHPCS < 3.5.7

Apply the same fix which was previously already applied to the FunctionDeclarations::getProperties() method in PR #180 to work around a tokenizer bug in PHPCS where the scope opener for a function would not be set if the namespace keyword as an operator is used in a return type.

Related to squizlabs/PHP_CodeSniffer#3066

BCFile::getMemberProperties(): sync with PHPCS / union type support

PR #168 added support for union types to the Variables::getMemberProperties() method and by extension the BCFile::getMemberProperties() method, even though PHPCS upstream did not support union types yet.

Upstream PR 3032 added support for union types to the PHPCS native File::getMemberProperties() method.

As that PR has now been merged, this commit syncs the upstream changes in, by moving the unit tests from the "Diff" tests to the BCFile tests and annotating that union types are now officially supported in the BCFile::getMemberProperties() method.

Upstream PR 3032 introduces a new `T_TYPE_UNION` token for the `|` in union types.

This token is now included in the `Collections::parameterTypeTokens()` method and by extension in the `Collections::parameterTypeTokensBC()` method if the PHPCS version allows for it.

Includes updated unit test.
Upstream PR 3032 introduces a new `T_TYPE_UNION` token for the `|` in union types.

This token is now included in the `Collections::propertyTypeTokens()` method and by extension in the `Collections::propertyTypeTokensBC()` method if the PHPCS version allows for it.

Includes updated unit test.
Upstream PR 3032 introduces a new `T_TYPE_UNION` token for the `|` in union types.

This token is now included in the `Collections::returnTypeTokens()` method and by extension in the `Collections::returnTypeTokensBC()` method if the PHPCS version allows for it.

Includes updated unit test.
PR 168 added support for union types to the `FunctionDeclarations::getParameters()` method.

Upstream PR 3032 added the same to the PHPCS native `File::getMethodParameters()` method.

As that PR has now been merged, this commit syncs the upstream changes into the `BCFile::getMethodParameters()` method, moves the unit tests to the BCFile test class and makes a minor change to the `FunctionDeclarations::getParameters()` method to support the changes as have been merged upstream.
PR 168 added support for union types to the `FunctionDeclarations::getProperties()` method and by extension the `BCFile::getMethodProperties()` method, even though PHPCS upstream did not support union types yet.

Upstream PR 3032 added support for union types to the PHPCS native `File::getMethodProperties()` method.

As that PR has now been merged, this commit syncs the upstream changes in, by moving the unit tests from the "Diff" tests to the BCFile tests and annotating that union types are now officially supported in the `BCFile::getMethodProperties()` method.
Apply the same fix which was previously already applied to the `FunctionDeclarations::getProperties()` method to work around a tokenizer bug in PHPCS where the scope opener for a function would not be set if the `namespace` keyword as an operator is used in a return type.
PR 168 added support for union types to the `Variables::getMemberProperties()` method and by extension the `BCFile::getMemberProperties()` method, even though PHPCS upstream did not support union types yet.

Upstream PR 3032 added support for union types to the PHPCS native `File::getMemberProperties()` method.

As that PR has now been merged, this commit syncs the upstream changes in, by moving the unit tests from the "Diff" tests to the BCFile tests and annotating that union types are now officially supported in the `BCFile::getMemberProperties()` method.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Nov 3, 2020
@jrfnl jrfnl merged commit 846c93b into develop Nov 3, 2020
@jrfnl jrfnl deleted the feature/union-types-sync-with-phpcs branch November 3, 2020 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant