New reusable workflow: "find token properties"#27
Merged
Conversation
PHP_CodeSniffer originally offered a number of "token groups" as static properties in the `Tokens` class to allow re-use of these groups across sniffs. As of PHP_CodeSniffer 4.0.0, these static properties still exist, but are now (soft) deprecated in favour of class constants in the `Tokens` class for the same, which should create more stability, as this means the token groups can no longer be changed from within a(n external) sniff. PHP_CodeSniffer related projects which still support both PHPCS 3.x as well as 4.x, will, for the time being, still need to use the static properties from the `Tokens` class. Once a PHP_CodeSniffer related project has dropped support for PHPCS 3.x though, they can enforce the use of the class constants from the `Tokens` class by running this re-usable workflow in their CI. * This workflow is particularly useful for repositories which have existing open PRs at the time of the PHPCS version drop and these open PRs should not re-introduce references to the static properties. * This workflow can also be helpful for repositories which have contributors which contribute to a range of PHPCS related repos and for whom it would be very easy to overlook that they've used the "old-school" token group instead of the new-fangled token group constants. In contrast to most of the other reusable workflows, this workflow does not work based on a configuration file. One should only add a job calling this workflow to a project's CI once support for PHPCS 3.x has been dropped. Includes adding documentation about this workflow to the `README` file.
Member
Author
|
Note: the "Markdown" workflow failure can be ignored - this is due to the documentation in the |
fredden
approved these changes
Dec 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP_CodeSniffer originally offered a number of "token groups" as static properties in the
Tokensclass to allow re-use of these groups across sniffs.As of PHP_CodeSniffer 4.0.0, these static properties still exist, but are now (soft) deprecated in favour of class constants in the
Tokensclass for the same, which should create more stability, as this means the token groups can no longer be changed from within a(n external) sniff.PHP_CodeSniffer related projects which still support both PHPCS 3.x as well as 4.x, will, for the time being, still need to use the static properties from the
Tokensclass.Once a PHP_CodeSniffer related project has dropped support for PHPCS 3.x though, they can enforce the use of the class constants from the
Tokensclass by running this re-usable workflow in their CI.In contrast to most of the other reusable workflows, this workflow does not work based on a configuration file.
One should only add a job calling this workflow to a project's CI once support for PHPCS 3.x has been dropped.
Includes adding documentation about this workflow to the
READMEfile.