Core: move rules related to object instantiations from Extra to Core #2133
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.
Core: move rules related to object instantiations from Extra to Core
Note: the spacing inside the parentheses when instantiating anonymous classes will not (yet) be checked by the
PEAR.Functions.FunctionCallSignature
sniff. A PR is open upstream to add support for this: squizlabs/PHP_CodeSniffer#3636Once the upstream PR has been merged, WPCS will automatically inherit the support as this sniff is already included in WPCS.
The following will no longer be checked by WPCS:
This is a parse error since PHP 7.0, so should not be the concern of WPCS (and hasn't been added to the handbook for the same reason). See: https://3v4l.org/W2Qj6
As discussed in #1884, this means that JS support for checking object instantiations will be dropped, but as WPCS is generally not used for checking JS code, this should not be a problem.
Refs and related issues:
ClassInstantiation
sniff toWordPress-Extra
. #1033Universal.Classes.Disallow/RequireAnonClassParentheses
sniffs PHPCSStandards/PHPCSExtra#76Universal.WhiteSpace.AnonClassKeywordSpacing
sniff PHPCSStandards/PHPCSExtra#120Fixes #1884
Fixes #2033
Remove the Classes/ClassInstantiation sniff
... as it is now no longer used.