Support namespace operator in type declarations #180
Merged
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.
Largely the same changes as pulled upstream in squizlabs/PHP_CodeSniffer#3066
Collections: allow for namespace operator in type declarations
This adds support for the namespace keyword used as an operator in property, parameter and return type declarations.
Includes adjusted unit tests.
FunctionDeclarations: add test for namespace operator in arrow function type declarations
The commit which added namespace operator support to the
Collections::returnTypeTokens[BC]()
methods implicitly added support for the namespace operator in type declarations for arrow functions, i.e. to theFunctionDeclarations::isArrowFunction()
and theFunctionDeclarations::getArrowFunctionOpenClose()
methods.This commit adds a unit test to safeguard this support.
FunctionDeclarations::getProperties(): add tests verifying support for namespace operator in types
The commit which added support for the namespace keyword used as an operator to the
Collections::returnTypeTokens[BC]()
methods implicitly added support for this to theFunctionDeclarations::getProperties()
method.This commit adds a unit test to safeguard this support.
The same commit also silently added support for the namespace operator to the
BCFile::getMethodProperties()
method. Namespace operators in return types are not supported yet in PHPCS itself and until they are, the fact that theBCFile::getMethodProperties()
method supports this should be regarded as an artifact and not as official support.FunctionDeclarations::getParameters(): add support for namespace operator in types
This commit adds support for the namespace keyword used as an operator to the
FunctionDeclarations::getParameters()
method.Changes along the same lines as included in this PR will also be pulled upstream to PHPCS itself. Once the upstream PR has been merged, those changes will also be applied to the
BCFile::getMethodParameters()
method.Includes unit test.
Variables::getMemberProperties(): add tests verifying support for namespace operator in types
The commit which added support for the namespace keyword used as an operator to the
Collections::propertyTypeTokens[BC]()
methods implicitly added support for this to theVariables::getMemberProperties()
method.This commit adds a unit test to safeguard this support.
The same commit also silently added support for the namespace operator to the
BCFile::getMemberProperties()
method. Namespace operators in property types are not supported yet in PHPCS itself and until they are, the fact that theBCFile::getMemberProperties()
method supports this should be regarded as an artifact and not as official support.