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

UtilityMethodTestCase: new usesPhp8NameTokens() method #200

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions PHPCSUtils/TestUtils/UtilityMethodTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,27 @@ public static function resetTestFile()
self::$phpcsFile = null;
}

/**
* Check whether or not the PHP 8.0 identifier name tokens will be in use.
*
* The expected token positions/token counts for certain tokens will differ depending
* on whether the PHP 8.0 identifier name tokenization is used or the PHP < 8.0
* identifier name tokenization.
*
* Tests can use this method to determine which flavour of tokenization to expect and
* to set test expectations accordingly.
*
* @codeCoverageIgnore Nothing to test.
*
* @since 1.0.0
*
* @return bool
*/
public static function usesPhp8NameTokens()
{
return \version_compare(\PHP_VERSION_ID, '80000', '>=') === true;
}

/**
* Get the token pointer for a target token based on a specific comment.
*
Expand Down