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

Tokens\Collections: new methods for improved compatibility with PHPCS 4.x #109

Merged
merged 4 commits into from
Mar 18, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 18, 2020

Collections: compatibility with PHPCS 4.x

⚠️ BREAKING CHANGE ⚠️

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 the BCFile::getMethodProperties() and the FunctionDeclarations::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 the BCFile::getMemberProperties() and the Variables::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 the FunctionDeclarations::getArrowFunctionOpenClose() method to allow it to be cross-version compatible with PHPCS 2.6.0 - 4.x.

jrfnl added 4 commits March 18, 2020 11:22
** BREAKING CHANGE **

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:
* squizlabs/PHP_CodeSniffer@cba0001
…h PHPCS 4.x

This implements use of the `PHPCSUtils\Tokens\Collections::returnTypeTokensBC()` method in the `BCFile::getMethodProperties()` and the `FunctionDeclarations::getProperties()` methods to allow them to be cross-version compatible with PHPCS 2.6.0 - 4.x.
This implements use of the `PHPCSUtils\Tokens\Collections::propertyTypeTokensBC()` method in the `BCFile::getMemberProperties()` and the `Variables::getMemberProperties()` methods to allow them to be cross-version compatible with PHPCS 2.6.0 - 4.x.
… PHPCS 4.x

This implements use of the `PHPCSUtils\Tokens\Collections::returnTypeTokensBC()` method in the `FunctionDeclarations::getArrowFunctionOpenClose()` method to allow it to be cross-version compatible with PHPCS 2.6.0 - 4.x.
@jrfnl jrfnl added this to the 1.0.0 milestone Mar 18, 2020
@jrfnl jrfnl merged commit 203be8d into develop Mar 18, 2020
@jrfnl jrfnl deleted the token-collections/new-methods-for-compat-phpcs-4.x branch March 18, 2020 11:09
@jrfnl jrfnl mentioned this pull request Mar 26, 2020
5 tasks
@jrfnl jrfnl modified the milestones: 1.0.0, 1.0.0-alpha3 May 1, 2020
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.

1 participant