Skip to content

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 5, 2020

PHPCS 4.x | Operators::isReference(): handle closure use as parenthesis owner

T_USE tokens used for closure use statements are parentheses owners as of PHPCS 4.x.

This makes a minor code adjustment to handle this in the Operators::isReference() method.

The previous code would already handle it correctly, but this adds some forward-compatibility code for when support for PHPCS < 4 would be dropped.

A similar change will be pulled to PHPCS itself once squizlabs/PHP_CodeSniffer#3104, which fixes significant bugs in the current implementation of parenthesis support for T_USE tokens, has been merged

PHPCS 4.x | BCTokens::parenthesisOpeners(): T_USE is now a parenthesis opener

T_USE tokens used for closure use statements are parentheses openers as of PHPCS 4.x.

This includes the token having been added to the Tokens::$parenthesisOpeners array.

This syncs that change into PHPCSUtils.

The method itself does not need to change as it will automatically pick up on this.
The unit test, however, does need updating.

Refs:

…is owner

`T_USE` tokens used for closure use statements are parentheses owners as of PHPCS 4.x.

This makes a minor code adjustment to handle this in the `Operators::isReference()` method.

The previous code would already handle it correctly, but this adds some forward-compatibility code for when support for PHPCS < 4 would be dropped.

Refs:
* squizlabs/PHP_CodeSniffer 2593
* squizlabs/PHP_CodeSniffer@08824f3
* squizlabs/PHP_CodeSniffer 3104
* squizlabs/PHP_CodeSniffer xxxx
…s opener

`T_USE` tokens used for closure use statements are parentheses openers as of PHPCS 4.x.

This includes the token having been added to the `Tokens::$parenthesisOpeners` array.

This syncs that change into PHPCSUtils.

The method itself does not need to change as it will automatically pick up on this.
The unit test, however, does need updating.

Refs:
* squizlabs/PHP_CodeSniffer 2593
* squizlabs/PHP_CodeSniffer@08824f3
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Sep 5, 2020
@jrfnl jrfnl merged commit 87ca29d into develop Sep 5, 2020
@jrfnl jrfnl deleted the phpcs-4.x/t_use-parenthesis-owner-initial-changes branch September 5, 2020 22:19
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.

1 participant