PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
The coding standard of this code base was historically/organically grown and is likely influenced by some internal rules which were being used in Squiz projects at one time or another....
## Description This is a re-creation of https://github.com/squizlabs/PHP_CodeSniffer/pull/3631 > `Generic.WhiteSpace.ScopeIndent` and `PSR2.Methods.FunctionCallSignature` both try to fix indentation differently. This results in files not being able to be fixed automatically with...
# Description This PR adds documentation for the `Squiz.WhiteSpace.FunctionSpacing` Sniff. ## Suggested changelog entry Add documentation for the Squiz Function Spacing Sniff ## Related issues/external references Part of https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/148 ##...
## Describe the bug The Generic.ControlStructures.DisallowYodaConditions sniff has a method called `isArrayStatic()` that determines what the sniff considers to be static arrays. When static arrays are found on the side...
Repost from https://github.com/squizlabs/PHP_CodeSniffer/issues/2962: > The `Generic.ControlStructures.DisallowYodaConditions` reports a `Usage of Yoda conditions is not allowed; switch the expression order` error for the below code, which IMO is incorrect (the error,...
## Description Recreation of upstream PR https://github.com/squizlabs/PHP_CodeSniffer/pull/1542: > I've explicitly not added metrics for: > * lowercase keyword as those are already recorded by the `Generic.PHP.LowerCaseKeyword` sniff > * `break`/`return`...
## Description The `AbstractVariableSniff` by default listens to all `T_VARIABLE`, `T_DOUBLE_QUOTED_STRING` and `T_HEREDOC` tokens. The majority of the sniffs extending the `AbstractVariableSniff`, however, only handle `T_VARIABLE` tokens and in particular,...
## Description This PR adds the XML documentation for the Generic.Commenting.DocComment sniff. This sniff contains several errors, so I opted to add a `` block at the top summarizing all...
The original PHP_CodeSniffer project contained a code consistency analysis website: https://squizlabs.github.io/PHP_CodeSniffer/analysis/ That website hadn't been updated since 2018. For now, I've removed the site from the `gh-pages` branch of this...
## Describe the bug Seems PEAR.Functions.FunctionCallSignature.Indent sniff and fix works incorrectly with some nested structures. The problem appears when there is indentation issue together with another issue, like PEAR.WhiteSpace.ScopeIndent.Incorrect. After...