Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UtilityMethodTestCase: new
usesPhp8NameTokens()
method
In PHP 8.0 identifier name tokenization will change as outline in the [accepted RFC "Treat namespaced names as single token"](https://wiki.php.net/rfc/namespaced_names_as_token). When the PHP 8.0 identifier name tokenization is used, the target token to find for some tests will need to be a different token - for instance: `T_STRING` vs `T_FULLY_QUALIFIED_NAME` -. Along the same lines, the expected token positions in the return value of various functions will also be different when the PHP < 8.0 tokenization is used as certain tokens will be "squashed" into one token. This adds a test helper method to allow tests to "know" whether or not to expect the PHP 8.0 identifier name tokenization, so the test setup/expectations can be adjusted based on the expected tokenization. The method is based on the _current reality_. At this time the PHP 8 tokenization should be expected on all PHPCS versions when run on PHP 8. Refs: * https://wiki.php.net/rfc/namespaced_names_as_token * [Proposal for handling this PHP 8 change in PHPCS](squizlabs/PHP_CodeSniffer#3041) * [Open PR for the PHPCS 3.x branch to "undo" the PHP 8 tokenization](squizlabs/PHP_CodeSniffer#3063)
- Loading branch information