-
-
Notifications
You must be signed in to change notification settings - Fork 86
4.0 | Add parameter types to all (non-test) methods #1237
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
Merged
Merged
Conversation
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
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
Associated update PR for the PHPCS 4.0 dev upgrade guide: PHPCSStandards/PHP_CodeSniffer-documentation#55 |
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.
Description
4.0 | PHPCS Framework classes: add parameter types
4.0 | Files: add parameter types
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.4.0 | Filters: add parameter types
4.0 | Generators: add parameter types
Includes changing the expected parameter type for a couple of methods from
DomNode
toDomElement
.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.
4.0 | Reports: add parameter types
4.0 | Tokenizers: add parameter types
4.0 | Util classes: add parameter types
This commit explicitly does not include adding a parameter type to the
MessageCollector::add()
$message
and$type
parameters and theCommon::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).
4.0 | (Abstract) Sniff classes: add parameter types
4.0 | Standards/Generic: add parameter types to sniffs
4.0 | Standards/PEAR: add parameter types to sniffs
4.0 | Standards/PSR: add parameter types to sniffs
4.0 | Standards/Squiz: add parameter types to sniffs
4.0 | Standards/Zend: add parameter types to sniffs
4.0 | Tests: add parameter types to sniffs used as test fixtures
4.0 | AbstractSniffTestCase: add parameter types
Includes updating the sniff test classes overloading these methods.
Suggested changelog entry
Related issues/external references
Fixes #390