-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
This file contains 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
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theCollections::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 theCollections::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 theCollections::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 theFunctionDeclarations::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 theBCFile::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 thenamespace
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 theBCFile::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.