Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 13, 2020

As per PR #200;

  • The expected target token type may be different for certain tests depending on whether the PHP 8.0 identifier name tokenization is used.
  • The expected token positions in method return values may also be different when the PHP 8.0 identifier name tokenization is used.
  • And in some cases, the target token just plainly won't exist when the PHP 8.0 identifier name tokenization is used and the utility method will not be applicable.

This PR adjusts the existing unit tests for PHPCSUtils to allow for the PHP 8.0 identifier name tokenization, using the new UtilityMethodTestCase::usesPhp8NameTokens to determine when to set which expectations.

…() method

This adjusts the tests for various utilities to take the different token positions, when PHP 8.0 identifier names are used, into account.
…is used

When the PHP 8 identifier name tokenization is used, the `T_NAMESPACE` token for the `namespace` keyword when used as an operator will no longer exist. Similarly, the `T_STRING` for `name` in a `namespace\name` snippet will no longer exist.

For certain test cases were setup specifically to prevent false positives/negatives for that type of code.

As the "target" token which would be passed to the functions which could have these false positives/negatives, won't exist when the PHP 8 identifier name tokenization is used, these false positives/negatives won't occur and the test becomes redundant.

This commit adds selective test skipping for a limited number of test cases where this applies.
…tokenization

Add a toggle to retrieve the right token based on the expected tokenization for a test.
…zation

Add a toggle to retrieve the right token based on the expected tokenization for a test.
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