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

4.0 | Let T_STATIC be T_STATIC #37

Open
wants to merge 1 commit into
base: 4.0
Choose a base branch
from

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 9, 2023

Description

Recreation of upstream PR squizlabs/PHP_CodeSniffer#3121:

Implementation of the proposal outlined in issue squizlabs/PHP_CodeSniffer#3115.

  1. Removes the Tokenizer/PHP code which made an exception for instanceof static.
  2. Adds an exception for instanceof static to the Squiz.WhiteSpace.ScopeKeywordSpacing sniff for which the tokenizer code was originally put in place.

The tests for all other sniffs still pass.

I've had a quick look through the other sniffs which refer to the T_STATIC token, but didn't see any which should be impacted by this change (and didn't have unit tests with instanceof static).

Fixes squizlabs/PHP_CodeSniffer#3115

Suggested changelog entry

Tokenizer/PHP: the static keyword when used in instanceof static will now be tokenized as T_STATIC instead of T_STRING.

Related issues/external references

Fixes #22

@jrfnl jrfnl added this to the 4.0.0 milestone Nov 9, 2023
@jrfnl jrfnl force-pushed the phpcs-4.x/3115-let-static-be-static branch 2 times, most recently from 47a1e98 to 0f23739 Compare November 11, 2023 04:08
@jrfnl jrfnl force-pushed the phpcs-4.x/3115-let-static-be-static branch from 0f23739 to e8d665c Compare December 6, 2023 00:24
Implementation of the proposal outlined in issue 3115.

1. Removes the Tokenizer/PHP code which made an exception for `instanceof static`.
2. Adds an exception for `instanceof static` to the `Squiz.WhiteSpace.ScopeKeywordSpacing` sniff for which the tokenizer code was originally put in place.

The tests for all other sniffs still pass.

I've had a quick look through the other sniffs which refer to the `T_STATIC` token, but didn't see any which should be impacted by this change (and didn't have unit tests with `instanceof static`).

Fixes 3115
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.

None yet

1 participant