4.0 | Add parameter types to all (non-test) methods by jrfnl · Pull Request #1237 · PHPCSStandards/PHP_CodeSniffer

added 15 commits

September 11, 2025 22:07
This commit explicitly does **not** include adding a parameter type to the `File::getTokensAsString()` `$start` and `$length` parameters as the pre-existing inline parameter validation is more comprehensive and more reliable.
Includes changing the expected parameter type for a couple of methods from `DomNode` to `DomElement`.
The previous was incorrect, but changing the method signature by making a type more specific, is a breaking change, so had to wait until now.
This commit explicitly does **not** include adding a parameter type to the `MessageCollector::add()` `$message` and `$type` parameters and the `Common::getSniffCode()` `$sniffsClass` parameter, as the pre-existing inline parameter validation is more comprehensive and more reliable.

Includes removing a type check from an "internal-only" class which is no longer necessary (and updating the associated test).
Includes updating the sniff test classes overloading these methods.

This was referenced

Sep 11, 2025

@jrfnl jrfnl deleted the phpcs-4.x/feature/390-add-param-types branch

September 11, 2025 23:13

@jrfnl jrfnl mentioned this pull request

Sep 13, 2025

This was referenced

Sep 16, 2025