Skip to content

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

Development

Successfully merging this pull request may close these issues.

2 participants