PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

Results 136 PHP_CodeSniffer issues
Sort by recently updated
recently updated
newest added

# Description ### Common::getSniffCode(): add tests Add initial set of tests for the `Common::getSniffCode()` method. Related to #146 Related to [review comment in PR 446](https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/446#discussion_r1573947430). ### Common::getSniffCode(): throw exception on...

Type: chores/QA
Core Component: File
Core Component: Utils

## Describe the bug Destructuring an array for foreach - `foreach ($data as [, , $value]) {` - violates the `Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma` ("Expected 0 spaces between "," and comma; 1 found")...

Type: bug
Focus: Modern PHP
Standard: Squiz

## Describe the bug Array destructuring is a syntax in PHP where items of an array are assigned to single variables, using an array construct on the left of the...

Type: bug
Standard: Squiz

## Motivation Sniffs should always be able to rely on the token arrays declared as static properties in the `Tokens` to be stable. These token arrays should never be changed/updated...

Type: breaking change
Type: meta
Core Component: Utils
Status: waiting for opinions

Inspired by the conversation in [this PR review thread](https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/446#discussion_r1564596545). PHPCS uses `for`/`foreach`/`while` loops _a lot_ and quite often the variables created for those loops are not destroyed after the loop...

Status: good first issue
Type: chores/QA
Status: help wanted

## Is your feature request related to a problem? When writing some sniff fixes, it's necessary to remove an entire line. Currently there is no helper for this. This is...

Status: awaiting feedback
Type: enhancement
Status: triage

**Describe the bug** This bug was originally reported here: https://github.com/squizlabs/PHP_CodeSniffer/issues/3564 Forgive me if there is already a ticket for this or if it should not reported again here. But I...

Type: bug
Status: triage

# Description Follow up to squizlabs/PHP_CodeSniffer#3716 and PR #524. PR squizlabs/PHP_CodeSniffer#3716 improved the information provided in the error messages for `Internal.Exception`s with additional information about the source of the problem....

Type: bug
Core Component: Other

The spacing after the `final` keyword should be checked by ScopeKeywordSpacingSniff. # Description This should throw an error because there are 6 spaces after `final`: ```php class FinalTest { final...

Status: awaiting feedback
Type: enhancement
Standard: Squiz

# Description As originally discussed in https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/482#pullrequestreview-2062765716 (see the "Commit 2 - stop listening for T_SWITCH" section), this PR changes the `Generic.ControlStructures.InlineControlStructure` sniff to stop listening for `T_SWITCH` tokens as...

Standard: Generic
Status: has merge conflict