Make codebase compatible with PHPCS 4.0 by jrfnl · Pull Request #1911 · PHPCompatibility/PHPCompatibility
added 30 commits
September 8, 2025 16:55…anceof static` The `static` keyword is generally tokenized as `T_STATIC`. However, in PHPCS 3.x, there was one exception - when `static` was used in an `instanceof static` expression, the `static` keyword was tokenized as `T_STRING`. As of PHPCS 4.0, this exception has been removed and `static` in `instanceof static` will now also be tokenized as `T_STATIC`. This commit updates the sniff for compatibility with that change.
…paced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This is relevant for this abstract sniff as it looks for method calls (unchanged, still `T_STRING`) and calls to global functions which may be called either in unqualified or fully qualified form, i.e. `callMe()` or `\callMe()`, with the first needing special handling on PHPCS 3.x to prevent recognizing `Something\callMe()` as the global function, while the second is tokenized differently on PHPCS 4.x, which removes the need for the special handling, but does mean we need to sniff for an extra token. This commit sorts this all out. :point_right: Reviewing this commit will be more straight-forward while ignoring whitespace changes.
…spaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff. Includes a slew of extra tests just to be sure.
…okenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…ed name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…me tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…PHPCS 4.0/PHP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… error message consistent ... in light of the different way fully qualified exit/die is tokenized in PHPCS 4.0.
…PHP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…paced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…enization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of fully qualified function calls to this sniff. Note: this commit will be more straight forward to review while ignoring whitespace changes.
….0/PHP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…mespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…spaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…HP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…/PHP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
… namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…ame tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…ed name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…espaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…spaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
…HP 8.0 namespaced name tokenization The tokenization of (namespaced) "names" has changed in PHP 8.0 and while this new tokenization was "undone" for PHPCS 3.x, as of PHP_CodeSniffer 4.0.0, the new tokenization is used. This commit adds handling for the new tokenization of namespaced names to this sniff.
* Allow for Composer installation with PHPCS `^4.0`. * Update GH Actions workflows to test all PHP versions against PHPCS 4.x and those builds are no longer allowed to fail. Note: once PHPCS 4.0 has been released, the workflows will get another update to also test against "low" 4.x, but that should wait until the release.
wimg approved these changes Sep 8, 2025
wimg
deleted the
feature/phpcs-4.x-compatibility
branch
jrfnl
mentioned this pull request
jrfnl
mentioned this pull request
55 tasks
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