Tokens\Collections: new methods for improved compatibility with PHPCS 4.x #109
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.
Collections: compatibility with PHPCS 4.x
This adds three new methods to the
PHPCSUtils\Tokens\Collections
class:parameterTypeTokensBC()
propertyTypeTokensBC()
returnTypeTokensBC()
... and adjusts the existing
$parameterTypeTokens
,$propertyTypeTokens
and$returnTypeTokens
properties to no longer contain token constants which will be removed in PHPCS 4.x.As things stands at this time, standards implementing PHPCSUtils which only support PHPCS 3.5.4 or higher, can safely use the properties.
If an external standard wants to continue support for PHPCS < 3.5.4 (return types) or PHPCS < 3.3.0 (parameter and property types), the standard should use the methods instead.
Includes dedicated unit tests for the new methods.
Refs:
BCFile/FunctionDeclarations::getMethodProperties(): compatibility with PHPCS 4.x
This implements use of the
PHPCSUtils\Tokens\Collections::returnTypeTokensBC()
method in theBCFile::getMethodProperties()
and theFunctionDeclarations::getProperties()
methods to allow them to be cross-version compatible with PHPCS 2.6.0 - 4.x.BCFile/Variables::getMemberProperties(): compatibility with PHPCS 4.x
This implements use of the
PHPCSUtils\Tokens\Collections::propertyTypeTokensBC()
method in theBCFile::getMemberProperties()
and theVariables::getMemberProperties()
methods to allow them to be cross-version compatible with PHPCS 2.6.0 - 4.x.FunctionDeclarations::getArrowFunctionOpenClose(): compatibility with PHPCS 4.x
This implements use of the
PHPCSUtils\Tokens\Collections::returnTypeTokensBC()
method in theFunctionDeclarations::getArrowFunctionOpenClose()
method to allow it to be cross-version compatible with PHPCS 2.6.0 - 4.x.