chore(deps): update dependency squizlabs/php_codesniffer to v3.11.3 #6

Merged
kumi merged 2 commits from renovate/squizlabs-php_codesniffer-3.x-lockfile into main 2025-03-12 12:10:01 +00:00
Collaborator

This PR contains the following updates:

Package Type Update Change
squizlabs/php_codesniffer require-dev minor 3.5.5 -> 3.11.3

Release Notes

PHPCSStandards/PHP_CodeSniffer (squizlabs/php_codesniffer)

v3.11.3

Compare Source

Changed
  • Generic.ControlStructures.InlineControlStructure no longer unnecessarily listens for T_SWITCH tokens. #​595
  • Squiz.Functions.FunctionDeclarationArgumentSpacing: improvements to error message for SpaceBeforeComma error. #​783
  • The following sniff(s) have received efficiency improvements:
    • Squiz.Functions.FunctionDeclarationArgumentSpacing
    • Thanks to [Dan Wallis][@​fredden] and [Juliette Reinders Folmer][@​jrfnl] for the patches.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​620 : Squiz.Functions.FunctionDeclarationArgumentSpacing: newlines after type will now be handled by the fixer. This also prevents a potential fixer conflict.
  • Fixed bug #​782 : Tokenizer/PHP: prevent an "Undefined array key" notice during live coding for unfinished arrow functions.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line after reference token was not flagged nor fixed.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line after variadic token was not flagged nor fixed.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line before/after the equal sign for default values was not flagged nor fixed when equalsSpacing was set to 0.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer conflict when a new line is found before/after the equal sign for default values and equalsSpacing was set to 1.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer for spacing before/after equal sign could inadvertently remove comment.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​783 : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer will now handle comments between the end of a parameter and a comma more cleanly.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​784 : Squiz.WhiteSpace.FunctionSpacing: prevent fixer conflict when a multi-line docblock would start on the same line as the function close curly being examined.
    • Thanks to [Klaus Purer][@​klausi] for the patch

v3.11.2

Compare Source

Changed
  • Generators/HTML + Markdown: the output will now be empty (no page header/footer) when there are no docs to display. #​687
    • This is in line with the Text Generator which already didn't produce output if there are no docs.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Generators/HTML: only display a Table of Contents when there is more than one sniff with documentation. #​697
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Generators/HTML: improved handling of line breaks in <standard> blocks. #​723
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Generators/Markdown: improved compatibility with the variety of available markdown parsers. #​722
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Generators/Markdown: improved handling of line breaks in <standard> blocks. #​737
    • This prevents additional paragraphs from being displayed as code blocks.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Generic.NamingConventions.UpperCaseConstantName: the exact token containing the non-uppercase constant name will now be identified with more accuracy. #​665
  • Generic.Functions.OpeningFunctionBraceKernighanRitchie: minor improvement to the error message wording. #​736
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​527 : Squiz.Arrays.ArrayDeclaration: short lists within a foreach condition should be ignored.
  • Fixed bug #​665 : Generic.NamingConventions.UpperCaseConstantName: false positives and false negatives when code uses unconventional spacing and comments when calling define().
  • Fixed bug #​665 : Generic.NamingConventions.UpperCaseConstantName: false positive when a constant named DEFINE is encountered.
  • Fixed bug #​665 : Generic.NamingConventions.UpperCaseConstantName: false positive for attribute class called define.
  • Fixed bug #​665 : Generic.NamingConventions.UpperCaseConstantName: false positive when handling the instantiation of a class named define.
  • Fixed bug #​688 : Generators/Markdown could leave error_reporting in an incorrect state.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​698 : Generators/Markdown : link in the documentation footer would not parse as a link.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​738 : Generators/Text: stray blank lines after code sample titles.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​739 : Generators/HTML + Markdown: multi-space whitespace within a code sample title was folded into a single space.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.

v3.11.1

Compare Source

Changed
  • Output from the --generator=... feature will respect the OS-expected EOL char in more places. #​671
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
    • Thanks to [Bartosz Dziewoński][@​MatmaRex] and [Juliette Reinders Folmer][@​jrfnl] for their contributions.
Fixed
  • Fixed bug #​674 : Generic.WhiteSpace.HereNowdocIdentifierSpacing broken XML documentation
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Fixed bug #​675 : InvalidArgumentException when a ruleset includes a sniff by file name and the included sniff does not comply with the PHPCS naming conventions.
    • Notwithstanding this fix, it is strongly recommended to ensure custom sniff classes comply with the PHPCS naming conventions.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.

v3.11.0

Compare Source

Added
  • Runtime support for PHP 8.4. All known PHP 8.4 deprecation notices have been fixed.
    • Syntax support for new PHP 8.4 features will follow in a future release.
    • If you find any PHP 8.4 deprecation notices which were missed, please report them.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches.
  • Tokenizer support for PHP 8.3 "yield from" expressions with a comment between the keywords. #​529, #​647
    • Sniffs explicitly handling T_YIELD_FROM tokens may need updating. The PR description contains example code for use by sniff developers.
    • Additionally, the following sniff has been updated to support "yield from" expressions with comments:
      • Generic.WhiteSpace.LanguageConstructSpacing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • New Generic.WhiteSpace.HereNowdocIdentifierSpacing sniff. #​586, #​637
    • Forbid whitespace between the <<< and the identifier string in heredoc/nowdoc start tokens.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • New Generic.Strings.UnnecessaryHeredoc sniff. #​633
    • Warns about heredocs without interpolation or expressions in the body text and can auto-fix these to nowdocs.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Documentation for the following sniffs:
    • Generic.Arrays.ArrayIndent
    • Squiz.PHP.Heredoc
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] and [Juliette Reinders Folmer][@​jrfnl] for the patches.
Changed
  • The Common::getSniffCode() method will now throw an InvalidArgumentException exception if an invalid $sniffClass is passed. #​524, #​625
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Documentation generated using the --generator=... feature will now always be presented in natural order based on the sniff name(s). #​668
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Minor improvements to the display of runtime information. #​658
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Squiz.Commenting.PostStatementComment: trailing annotations in PHP files will now be reported under a separate, non-auto-fixable error code AnnotationFound. #​560, #​627
    • This prevents (tooling related) annotations from taking on a different meaning when moved by the fixer.
    • The separate error code also allows for selectively excluding it to prevent the sniff from triggering on trailing annotations, while still forbidding other trailing comments.
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] for the patch.
  • Squiz.ControlStructures.ForEachLoopDeclaration: the SpacingAfterOpen error code has been replaced by the SpaceAfterOpen error code. The latter is a pre-existing code. The former appears to have been a typo. #​582
  • The following sniff(s) have received efficiency improvements:
    • Generic.Classes.DuplicateClassName
    • Generic.NamingConventions.ConstructorName
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] and [Juliette Reinders Folmer][@​jrfnl] for the patches.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​3808 : Generic.WhiteSpace.ScopeIndent would throw false positive for tab indented multi-token yield from expression.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​630 : The tokenizer could inadvertently transform "normal" parentheses to DNF parentheses, when a function call was preceded by a switch-case / alternative syntax control structure colon.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​645 : On PHP 5.4, if yield was used as the declaration name for a function declared to return by reference, the function name would incorrectly be tokenized as T_YIELD instead of T_STRING.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​647 : Tokenizer not applying tab replacement in single token "yield from" keywords.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​647 : Generic.WhiteSpace.DisallowSpaceIndent did not flag space indentation in multi-line yield from.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​647 : Generic.WhiteSpace.DisallowTabIndent did not flag tabs inside yield from.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​652 : Generic.NamingConventions.ConstructorName: false positives for PHP-4 style calls to PHP-4 style parent constructor when a method with the same name as the parent class was called on another class.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​652 : Generic.NamingConventions.ConstructorName: false negatives for PHP-4 style calls to parent constructor for function calls with whitespace and comments in unconventional places.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​653 : Generic.Classes.DuplicateClassName : the sniff did not skip namespace keywords used as operators, which could lead to false positives.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​653 : Generic.Classes.DuplicateClassName : sniff going into an infinite loop during live coding.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​653 : Generic.Classes.DuplicateClassName : false positives/negatives when a namespace declaration contained whitespace or comments in unconventional places.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​653 : Generic.Classes.DuplicateClassName : namespace for a file going in/out of PHP was not remembered/applied correctly.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.10.3

Compare Source

Changed
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​553 : Squiz.Classes.SelfMemberReference: false negative(s) when namespace operator was encountered between the namespace declaration and the OO declaration.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​579 : AbstractPatternSniff: potential PHP notice during live coding.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​580 : Squiz.Formatting.OperatorBracket: potential PHP notice during live coding.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​581 : PSR12.ControlStructures.ControlStructureSpacing: prevent fixer conflict by correctly handling multiple empty newlines before the first condition in a multi-line control structure.
  • Fixed bug #​585 : Tokenizer not applying tab replacement in heredoc/nowdoc openers.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​588 : Squiz.PHP.EmbeddedPhp false positive when checking spaces after a PHP short open tag.
  • Fixed bug #​597 : Generic.PHP.LowerCaseKeyword did not flag nor fix non-lowercase anonymous class keywords.
    • Thanks to [Marek Štípek][@​maryo] for the patch.
  • Fixed bug #​598 : Squiz.PHP.DisallowMultipleAssignments: false positive on assignments to variable property on object stored in array.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​608 : Squiz.Functions.MultiLineFunctionDeclaration did not take (parameter) attributes into account when checking for one parameter per line.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Other
  • The provenance of PHAR files associated with a release can now be verified via GitHub Artifact Attestations using the GitHub CLI tool with the following command: gh attestation verify [phpcs|phpcbf].phar -o PHPCSStandards. #​574
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.

v3.10.2

Compare Source

Changed
  • The following sniff(s) have received efficiency improvements:
    • Generic.Functions.FunctionCallArgumentSpacing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • The array format of the information passed to the Reports::generateFileReport() method is now documented in the Reports interface. #​523
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​513 : Generic.Functions.FunctionCallArgumentSpacing did not ignore the body of a match expressions passed as a function argument, which could lead to false positives.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​533 : Generic.WhiteSpace.DisallowTabIndent: tab indentation for heredoc/nowdoc closers will no longer be auto-fixed to prevent parse errors. The issue will still be reported.
    • The error code for heredoc/nowdoc indentation using tabs has been made more specific - TabsUsedHeredocCloser - to allow for selectively excluding the indentation check for heredoc/nowdoc closers.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​534 : Generic.WhiteSpace.DisallowSpaceIndent did not report on space indentation for PHP 7.3 flexible heredoc/nowdoc closers.
    • Closers using space indentation will be reported with a dedicated error code: SpacesUsedHeredocCloser.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​537 : Squiz.PHP.DisallowMultipleAssignments false positive for list assignments at the start of a new PHP block after an embedded PHP statement.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​551 : Squiz.PHP.DisallowMultipleAssignments prevent false positive for function parameters during live coding.
  • Fixed bug #​554 : Generic.CodeAnalysis.UselessOverridingMethod edge case false negative when the call to the parent method would end on a PHP close tag.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​555 : Squiz.Classes.SelfMemberReference edge case false negative when the namespace declaration would end on a PHP close tag.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.10.1

Compare Source

Added
  • Documentation for the following sniffs:
    • Generic.Commenting.DocComment
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] for the patch.
Changed
  • The following have received efficiency improvements:
    • Type handling in the PHP Tokenizer
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for their contributions.
Fixed
  • Fixed bug #​110, #​437, #​475 : File::findStartOfStatement(): the start of statement/expression determination for tokens in parentheses/short array brackets/others scopes, nested within match expressions, was incorrect in most cases.
    The trickle down effect of the bug fixes made to the File::findStartOfStatement() method, is that the Generic.WhiteSpace.ScopeIndent and the PEAR.WhiteSpace.ScopeIndent sniffs should now be able to correctly determine and fix the indent for match expressions containing nested expressions.
    These fixes also fix an issue with the Squiz.Arrays.ArrayDeclaration sniff and possibly other, unreported bugs.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​504 : The tokenizer could inadvertently mistake the last parameter in a function call using named arguments for a DNF type.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​508 : Tokenizer/PHP: extra hardening against handling parse errors in the type handling layer.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.10.0

Compare Source

Added
  • Tokenizer support for PHP 8.2 Disjunctive Normal Form (DNF) types. #​3731, #​387, #​461
    • Includes new T_TYPE_OPEN_PARENTHESIS and T_TYPE_CLOSE_PARENTHESIS tokens to represent the parentheses in DNF types.
    • These new tokens, like other parentheses, will have the parenthesis_opener and parenthesis_closer token array indexes set and the tokens between them will have the nested_parenthesis index.
    • The File::getMethodProperties(), File::getMethodParameters() and File::getMemberProperties() methods now all support DNF types. #​471, #​472, #​473
    • Additionally, the following sniff has been updated to support DNF types:
      • Generic.PHP.LowerCaseType #​478
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches.
  • Documentation for the following sniffs:
    • Squiz.WhiteSpace.FunctionClosingBraceSpace
    • Thanks to [Przemek Hernik][@​przemekhernik] for the patch.
Changed
  • The help screens have received a face-lift for improved usability and readability. #​447
  • The Squiz.Commenting.ClosingDeclarationComment sniff will now also examine and flag closing comments for traits. #​442
  • The following sniff(s) have efficiency improvements:
    • Generic.Arrays.ArrayIndent
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] for the patch.
  • The autoloader will now always return a boolean value indicating whether it has loaded a class or not. #​479
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​466 : Generic.Functions.CallTimePassByReference was not flagging call-time pass-by-reference in class instantiations using the self/parent/static keywords.
  • Fixed bug #​494 : edge case bug in tokenization of an empty block comment.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​494 : edge case bug in tokenization of an empty single-line DocBlock.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​499 : Generic.ControlStructures.InlineControlStructure now handles statements with a comment between else and if correctly.

v3.9.2

Compare Source

Changed
  • The Generic.ControlStructures.DisallowYodaConditions sniff no longer listens for the null coalesce operator. #​458
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​381 : Squiz.Commenting.ClosingDeclarationComment could throw the wrong error when the close brace being examined is at the very end of a file.
  • Fixed bug #​385 : Generic.CodeAnalysis.JumbledIncrementer improved handling of parse errors/live coding.
  • Fixed bug #​394 : Generic.Functions.CallTimePassByReference was not flagging call-time pass-by-reference in anonymous class instantiations
  • Fixed bug #​420 : PEAR.Functions.FunctionDeclaration could run into a blocking PHP notice while fixing code containing a parse error.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​421 : File::getMethodProperties() small performance improvement & more defensive coding.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​423 : PEAR.WhiteSpace.ScopeClosingBrace would have a fixer conflict with itself when a close tag was preceded by non-empty inline HTML.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​424 : PSR2.Classes.ClassDeclaration using namespace relative interface names in the extends/implements part of a class declaration would lead to a fixer conflict.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​427 : Squiz.Operators.OperatorSpacing would have a fixer conflict with itself when an operator was preceeded by a new line and the previous line ended in a comment.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​430 : Squiz.ControlStructures.ForLoopDeclaration: fixed potential undefined array index notice
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​431 : PSR2.Classes.ClassDeclaration will no longer try to auto-fix multi-line interface implements statements if these are interlaced with comments on their own line. This prevents a potential fixer conflict.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​453 : Arrow function tokenization was broken when the return type was a stand-alone true or false; or contained true or false as part of a union type.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Other
  • ESLint 9.0 has been released and changes the supported configuration file format.
    The (deprecated) Generic.Debug.ESLint sniff only supports the "old" configuration file formats and when using the sniff to run ESLint, the ESLINT_USE_FLAT_CONFIG=false environment variable will need to be set when using ESLint >= 9.0.
    For more information, see #​436.

v3.9.1

Compare Source

Added
  • Documentation for the following sniffs:
    • Generic.PHP.RequireStrictTypes
    • Squiz.WhiteSpace.MemberVarSpacing
    • Squiz.WhiteSpace.ScopeClosingBrace
    • Squiz.WhiteSpace.SuperfluousWhitespace
    • Thanks to [Jay McPartland][@​jaymcp] and [Rodrigo Primo][@​rodrigoprimo] for the patches.
Changed
  • The following sniffs have received performance related improvements:
    • Generic.CodeAnalysis.UselessOverridingMethod
    • Generic.Files.ByteOrderMark
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] for the patches.
  • Performance improvement for the "Diff" report. Should be most notable for Windows users. #​355
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • The test suite has received some performance improvements. Should be most notable contributors using Windows. #​351
    • External standards with sniff tests using the PHP_CodeSniffer native test framework will also benefit from these changes.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch.
  • Various housekeeping, including improvements to the tests and documentation.
Fixed
  • Fixed bug #​289 : Squiz.WhiteSpace.OperatorSpacing and PSR12.Operators.OperatorSpacing : improved fixer conflict protection by more strenuously avoiding handling operators in declare statements.
  • Fixed bug #​366 : Generic.CodeAnalysis.UselessOverridingMethod : prevent false negative when the declared method name and the called method name do not use the same case.
  • Fixed bug #​368 : Squiz.Arrays.ArrayDeclaration fixer did not handle static closures correctly when moving array items to their own line.
  • Fixed bug #​404 : Test framework : fixed PHP 8.4 deprecation notice.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.9.0

Compare Source

Added
  • Tokenizer support for PHP 8.3 typed class constants. #​321
    • Additionally, the following sniffs have been updated to support typed class constants:
      • Generic.NamingConventions.UpperCaseConstantName #​332
      • Generic.PHP.LowerCaseConstant #​330
      • Generic.PHP.LowerCaseType #​331
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches
  • Tokenizer support for PHP 8.3 readonly anonymous classes. #​309
    • Additionally, the following sniffs have been updated to support readonly anonymous classes:
      • PSR12.Classes.ClassInstantiation #​324
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches
  • New PHP_CodeSniffer\Sniffs\DeprecatedSniff interface to allow for marking a sniff as deprecated. #​281
    • If a ruleset uses deprecated sniffs, deprecation notices will be shown to the end-user before the scan starts.
      When running in -q (quiet) mode, the deprecation notices will be hidden.
    • Deprecated sniffs will still run and using them will have no impact on the exit code for a scan.
    • In ruleset "explain"-mode (-e) an asterix * will show next to deprecated sniffs.
    • Sniff maintainers are advised to read through the PR description for full details on how to use this feature for their own (deprecated) sniffs.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • New Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence sniff. #​197
    • Forbid mixing different binary boolean operators within a single expression without making precedence clear using parentheses
    • Thanks to [Tim Düsterhus][@​TimWolla] for the contribution
  • Squiz.PHP.EmbeddedPhp : the sniff will now also examine the formatting of embedded PHP statements using short open echo tags. #​27
    • Includes a new ShortOpenEchoNoSemicolon errorcode to allow for selectively ignoring missing semicolons in single line embedded PHP snippets within short open echo tags.
    • The other error codes are the same and do not distinguish between what type of open tag was used.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Documentation for the following sniffs:
    • Generic.WhiteSpace.IncrementDecrementSpacing
    • PSR12.ControlStructures.ControlStructureSpacing
    • PSR12.Files.ImportStatement
    • PSR12.Functions.ReturnTypeDeclaration
    • PSR12.Properties.ConstantVisibility
    • Thanks to [Denis Žoljom][@​dingo-d] and [Rodrigo Primo][@​rodrigoprimo] for the patches
Changed
  • The Performance report can now also be used for a phpcbf run. #​308
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Sniff tests which extend the PHPCS native AbstractSniffUnitTest class will now show a (non-build-breaking) warning when test case files contain fixable errors/warnings, but there is no corresponding .fixed file available in the test suite to verify the fixes against. #​336
    • The warning is only displayed on PHPUnit 7.3.0 and higher.
    • The warning will be elevated to a test failure in PHPCS 4.0.
    • Thanks to [Dan Wallis][@​fredden] for the patch
  • The following sniffs have received performance related improvements:
    • Squiz.PHP.EmbeddedPhp
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Various housekeeping, including improvements to the tests and documentation
Deprecated
  • Support for scanning JavaScript and CSS files. See #​2448.
    • This also means that all sniffs which are only aimed at JavaScript or CSS files are now deprecated.
    • The Javascript and CSS Tokenizers, all Javascript and CSS specific sniffs, and support for JS and CSS in select sniffs which support multiple file types, will be removed in version 4.0.0.
  • The abstract PHP_CodeSniffer\Filters\ExactMatch::getBlacklist() and PHP_CodeSniffer\Filters\ExactMatch::getWhitelist() methods are deprecated and will be removed in the 4.0 release. See #​198.
    • In version 4.0, these methods will be replaced with abstract ExactMatch::getDisallowedFiles() and ExactMatch::getAllowedFiles() methods
    • To make Filters extending ExactMatch cross-version compatible with both PHP_CodeSniffer 3.9.0+ as well as 4.0+, implement the new getDisallowedFiles() and getAllowedFiles() methods.
      • When both the getDisallowedFiles() and getAllowedFiles() methods as well as the getBlacklist() and getWhitelist() are available, the new methods will take precedence over the old methods.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The MySource standard and all sniffs in it. See #​2471.
    • The MySource standard and all sniffs in it will be removed in version 4.0.0.
  • The Zend.Debug.CodeAnalyzer sniff. See #​277.
    • This sniff will be removed in version 4.0.0.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Fixed
  • Fixed bug #​127 : Squiz.Commenting.FunctionComment : The MissingParamType error code will now be used instead of MissingParamName when a parameter name is provided, but not its type. Additionally, invalid type hint suggestions will no longer be provided in these cases.
  • Fixed bug #​196 : Squiz.PHP.EmbeddedPhp : fixer will no longer leave behind trailing whitespace when moving code to another line.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​196 : Squiz.PHP.EmbeddedPhp : will now determine the needed indent with higher precision in multiple situations.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​196 : Squiz.PHP.EmbeddedPhp : fixer will no longer insert a stray new line when the closer of a multi-line embedded PHP block and the opener of the next multi-line embedded PHP block would be on the same line.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​235 : Generic.CodeAnalysis.ForLoopWithTestFunctionCall : prevent a potential PHP 8.3 deprecation notice during live coding
  • Fixed bug #​288 : Generic.WhiteSpace.IncrementDecrementSpacing : error message for post-in/decrement will now correctly inform about new lines found before the operator.
  • Fixed bug #​296 : Generic.WhiteSpace.ArbitraryParenthesesSpacing : false positive for non-arbitrary parentheses when these follow the scope closer of a switch case.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​307 : PSR2.Classes.ClassDeclaration : space between a modifier keyword and the class keyword was not checked when the space included a new line or comment.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​325 : Squiz.Operators.IncrementDecrementUsage : the sniff was underreporting when there was (no) whitespace and/or comments in unexpected places.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​335 : PSR12.Files.DeclareStatement : bow out in a certain parse error situation to prevent incorrect auto-fixes from being made.
  • Fixed bug #​340 : Squiz.Commenting.ClosingDeclarationComment : no longer adds a stray newline when adding a missing comment.
Other
  • A "Community cc list" has been introduced to ping maintainers of external standards and integrators for input regarding change proposals for PHP_CodeSniffer which may impact them. #​227
    • For anyone who missed the discussion about this and is interested to be on this list, please feel invited to submit a PR to add yourself.
      The list is located in the .github folder.

v3.8.1

Compare Source

Added
  • Documentation has been added for the following sniffs:
    • Generic.CodeAnalysis.EmptyPHPStatement
    • Generic.Formatting.SpaceBeforeCast
    • Generic.PHP.Syntax
    • Generic.WhiteSpace.LanguageConstructSpacing
    • PSR12.Classes.ClosingBrace
    • PSR12.Classes.OpeningBraceSpace
    • PSR12.ControlStructures.BooleanOperatorPlacement
    • PSR12.Files.OpenTag
    • Thanks to [Rodrigo Primo][@​rodrigoprimo] and [Denis Žoljom][@​dingo-d] for the patches
Changed
  • GitHub releases will now always only contain unversioned release assets (PHARS + asc files) (same as it previously was in the squizlabs repo). See #​205 for context.
    • Thanks to [Shivam Mathur][@​shivammathur] for opening a discussion about this
  • Various housekeeping, includes improvements to the tests and documentation
Fixed
  • Fixed bug #​124 : Report Full : avoid unnecessarily wrapping lines when -s is used
  • Fixed bug #​124 : Report Full : fix incorrect bolding of pipes when -s is used and messages wraps
  • Fixed bug #​150 : Squiz.WhiteSpace.KeywordSpacing : prevent a PHP notice when run during live coding
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​154 : Report Full : delimiter line calculation could go wonky on wide screens when a report contains multi-line messages
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​178 : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP native union/intersection type declarations
    • Thanks to [Ferdinand Kuhl][@​fcool] for the patch
  • Fixed bug #​211 : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP 8.2+ stand-alone true/false/null type declarations
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​211 : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP native parent, self or a namespace relative class name type declaration
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​226 : Generic.CodeAnalysis.ForLoopShouldBeWhileLoop : prevent a potential PHP 8.3 deprecation notice during live coding

v3.8.0

Compare Source

Squizlabs/PHP_CodeSniffer is dead. Long live PHPCSStandards/PHP_CodeSniffer!

Breaking Changes
  • The squizlabs/PHP_CodeSniffer repository has been abandoned. The PHPCSStandards/PHP_CodeSniffer repository will serve as the continuation of the project. For more information about this change, please read the announcement.
    • Installation of PHP_CodeSniffer via PEAR is no longer supported.
      • Users will need to switch to another installation method.
      • Note: this does not affect the PEAR sniffs.
    • For Composer users, nothing changes.
      • In contrast to earlier information, the squizlabs/php_codesniffer package now points to the new repository and everything will continue to work as before.
    • PHIVE users may need to clear the PHIVE URL cache.
      • PHIVE users who don't use the package alias, but refer to the package URL, will need to update the URL from https://squizlabs.github.io/PHP_CodeSniffer/phars/ to https://phars.phpcodesniffer.com/phars/.
    • Users who download the PHAR files using curl or wget, will need to update the download URL from https://squizlabs.github.io/PHP_CodeSniffer/[phpcs|phpcbf].phar or https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/[phpcs|phpcbf].phar to https://phars.phpcodesniffer.com/[phpcs|phpcbf].phar.
    • For users who install PHP_CodeSniffer via the Setup-PHP action runner for GitHub Actions, nothing changes.
    • Users using a git clone will need to update the clone address from git@github.com:squizlabs/PHP_CodeSniffer.git to git@github.com:PHPCSStandards/PHP_CodeSniffer.git.
      • Contributors will need to fork the new repo and add both the new fork as well as the new repo as remotes to their local git copy of PHP_CodeSniffer.
      • Users who have (valid) open issues or pull requests in the squizlabs/PHP_CodeSniffer repository are invited to resubmit these to the PHPCSStandards/PHP_CodeSniffer repository.
Added
  • Runtime support for PHP 8.3. All known PHP 8.3 deprecation notices have been fixed
    • Syntax support for new PHP 8.3 features will follow in a future release
    • If you find any PHP 8.3 deprecation notices which were missed, please report them
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches
  • Added support for PHP 8.2 readonly classes to File::getClassProperties() through a new is_readonly array index in the return value
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.2 readonly classes to a number of sniffs
    • Generic.CodeAnalysis.UnnecessaryFinalModifier
    • PEAR.Commenting.ClassComment
    • PEAR.Commenting.FileComment
    • PSR1.Files.SideEffects
    • PSR2.Classes.ClassDeclaration
    • PSR12.Files.FileHeader
    • Squiz.Classes.ClassDeclaration
    • Squiz.Classes.LowercaseClassKeywords
    • Squiz.Commenting.ClassComment
    • Squiz.Commenting.DocCommentAlignment
    • Squiz.Commenting.FileComment
    • Squiz.Commenting.InlineComment
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.2 true as a stand-alone type declaration
    • The File::getMethodProperties(), File::getMethodParameters() and File::getMemberProperties() methods now all support the true type
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.2 true as a stand-alone type to a number of sniffs
    • Generic.PHP.LowerCaseType
    • PSr12.Functions.NullableTypeDeclaration
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added a Performance report to allow for finding "slow" sniffs
    • To run this report, run PHPCS with --report=Performance.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.PHP.RequireStrictTypes : new warning for when there is a declare statement, but the strict_types directive is set to 0
    • The warning can be turned off by excluding the Generic.PHP.RequireStrictTypes.Disabled error code
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Squiz.Commenting.FunctionComment : new ParamNameUnexpectedAmpersandPrefix error for parameters annotated as passed by reference while the parameter is not passed by reference
  • Documentation has been added for the following sniffs:
    • PSR2.Files.ClosingTag
    • PSR2.Methods.FunctionCallSignature
    • PSR2.Methods.FunctionClosingBrace
    • Thanks to [Atsushi Okui][@​blue32a] for the patch
  • Support for PHPUnit 8 and 9 to the test suite
    • Test suites for external standards which run via the PHPCS native test suite can now run on PHPUnit 4-9 (was 4-7)
    • If any of these tests use the PHPUnit setUp()/tearDown() methods or overload the setUp() in the AbstractSniffUnitTest test case, they will need to be adjusted. See the PR details for further information
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Changed
  • Changes have been made to the way PHPCS handles invalid sniff properties being set in a custom ruleset
    • Fixes PHP 8.2 deprecation notices for properties set in a (custom) ruleset for complete standards/complete sniff categories
    • Invalid sniff properties set for individual sniffs will now result in an error and halt the execution of PHPCS
      • A descriptive error message is provided to allow users to fix their ruleset
    • Sniff properties set for complete standards/complete sniff categories will now only be set on sniffs which explicitly support the property
      • The property will be silently ignored for those sniffs which do not support the property
    • Invalid sniff properties set for sniffs via inline annotations will result in an informative Internal.PropertyDoesNotExist errror on line 1 of the scanned file, but will not halt the execution of PHPCS
    • For sniff developers, it is strongly recommended for sniffs to explicitly declare any user-adjustable public properties
      • If dynamic properties need to be supported for a sniff, either declare the magic __set()/__get()/__isset()/__unset() methods on the sniff or let the sniff extend stdClass
      • Note: The #[\AllowDynamicProperties] attribute will have no effect for properties which are being set in rulesets
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The third parameter for the Ruleset::setSniffProperty() method has been changed to expect an array
    • Sniff developers/integrators of PHPCS may need to make some small adjustments to allow for this change
    • Existing code will continue to work but will throw a deprecation error
    • The backwards compatiblity layer will be removed in PHPCS 4.0
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • When using auto report width (the default) a value of 80 columns will be used if the width cannot be determined
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Sniff error messages are now more informative to help bugs get reported to the correct project
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.CodeAnalysis.UnusedFunctionParameter will now ignore magic methods for which the signature is defined by PHP
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.Functions.OpeningFunctionBraceBsdAllman will now check the brace indent before the opening brace for empty functions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.Functions.OpeningFunctionBraceKernighanRitchie will now check the spacing before the opening brace for empty functions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.WhiteSpace.IncrementDecrementSpacing now detects more spacing issues
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • PSR2.Classes.PropertyDeclaration now enforces that the readonly modifier comes after the visibility modifier
    • PSR2 and PSR12 do not have documented rules for this as they pre-date the readonly modifier
    • PSR-PER has been used to confirm the order of this keyword so it can be applied to PSR2 and PSR12 correctly
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • PEAR.Commenting.FunctionComment + Squiz.Commenting.FunctionComment: the SpacingAfter error can now be auto-fixed
  • Squiz.PHP.InnerFunctions sniff no longer reports on OO methods for OO structures declared within a function or closure
  • Squiz.PHP.NonExecutableCode will now also flag redundant return statements just before a closure close brace
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Runtime performance improvement for PHPCS CLI users. The improvement should be most noticeable for users on Windows.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The following sniffs have received performance related improvements:
    • Generic.PHP.LowerCaseConstant
    • Generic.PHP.LowerCaseType
    • PSR12.Files.OpenTag
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches
  • The -e (explain) command will now list sniffs in natural order
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Tests using the PHPCS native test framework with multiple test case files will now run the test case files in numeric order.
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The following sniffs have received minor message readability improvements:
    • Generic.Arrays.ArrayIndent
    • Generic.Formatting.SpaceAfterCast
    • Generic.Formatting.SpaceAfterNot
    • Generic.WhiteSpace.SpreadOperatorSpacingAfter
    • Squiz.Arrays.ArrayDeclaration
    • Squiz.Commenting.DocCommentAlignment
    • Squiz.ControlStructures.ControlSignature
    • Thanks to [Danny van der Sluijs][@​DannyvdSluijs] and [Juliette Reinders Folmer][@​jrfnl] for the patches
  • Improved README syntax highlighting
  • Various documentation improvements
Removed
  • Removed support for installation via PEAR
    • Use composer or the PHAR files instead
Fixed
  • Fixed bug #​2857 : Squiz/NonExecutableCode: prevent false positives when exit is used in a ternary expression or as default with null coalesce
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3386 : PSR1/SideEffects : improved recognition of disable/enable annotations
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3557 : Squiz.Arrays.ArrayDeclaration will now ignore PHP 7.4 array unpacking when determining whether an array is associative
  • Fixed bug #​3592 : Squiz/NonExecutableCode: prevent false positives when a PHP 8.0+ inline throw expression is encountered
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3715 : Generic/UnusedFunctionParameter: fixed incorrect errorcode for closures/arrow functions nested within extended classes/classes which implement
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3717 : Squiz.Commenting.FunctionComment: fixed false positive for InvalidNoReturn when type is never
    • Thanks to [Choraimy Kroonstuiver][@​axlon] for the patch
  • Fixed bug #​3720 : Generic/RequireStrictTypes : will now bow out silently in case of parse errors/live coding instead of throwing false positives/false negatives
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3720 : Generic/RequireStrictTypes : did not handle multi-directive declare statements
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3722 : Potential "Uninitialized string offset 1" in octal notation backfill
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3736 : PEAR/FunctionDeclaration: prevent fixer removing the close brace (and creating a parse error) when there is no space between the open brace and close brace of a function
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3739 : PEAR/FunctionDeclaration: prevent fixer conflict, and potentially creating a parse error, for unconventionally formatted return types
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3770 : Squiz/NonExecutableCode: prevent false positives for switching between PHP and HTML
  • Fixed bug #​3773 : Tokenizer/PHP: tokenization of the readonly keyword when used in combination with PHP 8.2 disjunctive normal types
  • Fixed bug #​3776 : Generic/JSHint: error when JSHint is not available
  • Fixed bug #​3777 : Squiz/NonExecutableCode: slew of bug fixes, mostly related to modern PHP
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3778 : Squiz/LowercasePHPFunctions: bug fix for class names in attributes
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3779 : Generic/ForbiddenFunctions: bug fix for class names in attributes
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3785 : Squiz.Commenting.FunctionComment: potential "Uninitialized string offset 0" when a type contains a duplicate pipe symbol
  • Fixed bug #​3787 : PEAR/Squiz/[MultiLine]FunctionDeclaration: allow for PHP 8.1 new in initializers
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3789 : Incorrect tokenization for ternary operator with match inside of it
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3790 : PSR12/AnonClassDeclaration: prevent fixer creating parse error when there was no space before the open brace
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3797 : Tokenizer/PHP: more context sensitive keyword fixes
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3801 : File::getMethodParameters(): allow for readonly promoted properties without visibility
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3805 : Generic/FunctionCallArgumentSpacing: prevent fixer conflict over PHP 7.3+ trailing comma's in function calls
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3806 : Squiz.PHP.InnerFunctions sniff now correctly reports inner functions declared within a closure
  • Fixed bug #​3809 : GitBlame report was broken when passing a basepath
  • Fixed bug #​3813 : Squiz.Commenting.FunctionComment: false positive for parameter name mismatch on parameters annotated as passed by reference
  • Fixed bug #​3833 : Generic.PHP.LowerCaseType: fixed potential undefined array index notice
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3846 : PSR2.Classes.ClassDeclaration.CloseBraceAfterBody : fixer will no longer remove indentation on the close brace line
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3854 : Fatal error when using Gitblame report in combination with --basepath and running from project subdirectory
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3856 : PSR12.Traits.UseDeclaration was using the wrong error code - SpacingAfterAs - for spacing issues after the use keyword
    • These will now be reported using the SpacingAfterUse error code
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3856 : PSR12.Traits.UseDeclaration did not check spacing after use keyword for multi-line trait use statements
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3867 : Tokenizer/PHP: union type and intersection type operators were not correctly tokenized for static properties without explicit visibility
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3877 : Filter names can be case-sensitive. The -h help text will now display the correct case for the available filters
  • Fixed bug #​3893 : Generic/DocComment : the SpacingAfterTagGroup fixer could accidentally remove ignore annotations
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3898 : Squiz/NonExecutableCode : the sniff could get confused over comments in unexpected places
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3904 : Squiz/FunctionSpacing : prevent potential fixer conflict
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3906 : Tokenizer/CSS: bug fix related to the unsupported slash comment syntax
  • Fixed bug #​3913 : Config did not always correctly store unknown "long" arguments in the $unknown property
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

Thanks go to [Dan Wallis][@​fredden] and [Danny van der Sluijs][@​DannyvdSluijs] for reviewing quite a few of the PRs for this release.
Additionally, thanks to [Alexander Turek][@​derrabus] for consulting on the repo change over.

v3.7.2

Compare Source

Changed
  • Newer versions of Composer will now suggest installing PHPCS using require-dev instead of require
  • A custom Out Of Memory error will now be shown if PHPCS or PHPCBF run out of memory during a run
    • Error message provides actionable information about how to fix the problem and ensures the error is not silent
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] and [Alain Schlesser][@​schlessera] for the patch
  • Generic.PHP.LowerCaseType sniff now correctly examines types inside arrow functions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Squiz.Formatting.OperatorBracket no longer reports false positives in match() structures
Fixed
  • Fixed bug #​3616 : Squiz.PHP.DisallowComparisonAssignment false positive for PHP 8 match expression
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3618 : Generic.WhiteSpace.ArbitraryParenthesesSpacing false positive for return new parent()
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3632 : Short list not tokenized correctly in control structures without braces
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3639 : Tokenizer not applying tab replacement to heredoc/nowdoc closers
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3640 : Generic.WhiteSpace.DisallowTabIndent not reporting errors for PHP 7.3 flexible heredoc/nowdoc syntax
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3645 : PHPCS can show 0 exit code when running in parallel even if child process has fatal error
    • Thanks to [Alex Panshin][@​enl] for the patch
  • Fixed bug #​3653 : False positives for match() in OperatorSpacingSniff
  • Fixed bug #​3666 : PEAR.Functions.FunctionCallSignature incorrect indent fix when checking mixed HTML/PHP files
  • Fixed bug #​3668 : PSR12.Classes.ClassInstantiation.MissingParentheses false positive when instantiating parent classes
    • Similar issues also fixed in Generic.Functions.FunctionCallArgumentSpacing and Squiz.Formatting.OperatorBracket
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3672 : Incorrect ScopeIndent.IncorrectExact report for match inside array literal
  • Fixed bug #​3694 : Generic.WhiteSpace.SpreadOperatorSpacingAfter does not ignore spread operator in PHP 8.1 first class callables
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.7.1

Compare Source

Fixed
  • Fixed bug #​3609 : Methods/constants with name empty/isset/unset are always reported as error
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.7.0

Compare Source

Added
  • Added support for PHP 8.1 explicit octal notation
    • This new syntax has been backfilled for PHP versions less than 8.1
    • Thanks to [Mark Baker][@​MarkBaker] for the patch
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for additional fixes
  • Added support for PHP 8.1 enums
    • This new syntax has been backfilled for PHP versions less than 8.1
    • Includes a new T_ENUM_CASE token to represent the case statements inside an enum
    • Thanks to [Jaroslav Hanslík][@​kukulich] for the patch
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for additional core and sniff support
  • Added support for the PHP 8.1 readonly token
    • Tokenizing of the readonly keyword has been backfilled for PHP versions less than 8.1
    • Thanks to [Jaroslav Hanslík][@​kukulich] for the patch
  • Added support for PHP 8.1 intersection types
    • Includes a new T_TYPE_INTERSECTION token to represent the ampersand character inside intersection types
    • Thanks to [Jaroslav Hanslík][@​kukulich] for the patch
Changed
  • File::getMethodParameters now supports the new PHP 8.1 readonly token
    • When constructor property promotion is used, a new property_readonly array index is included in the return value
      • This is a boolean value indicating if the property is readonly
    • If the readonly token is detected, a new readonly_token array index is included in the return value
      • This contains the token index of the readonly keyword
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Support for new PHP 8.1 readonly keyword has been added to the following sniffs:
    • Generic.PHP.LowerCaseKeyword
    • PSR2.Classes.PropertyDeclaration
    • Squiz.Commenting.BlockComment
    • Squiz.Commenting.DocCommentAlignment
    • Squiz.Commenting.VariableComment
    • Squiz.WhiteSpace.ScopeKeywordSpacing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patches
  • The parallel feature is now more efficient and runs faster in some situations due to improved process management
    • Thanks to [Sergei Morozov][@​morozov] for the patch
  • The list of installed coding standards now has consistent ordering across all platforms
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.PHP.UpperCaseConstant and Generic.PHP.LowerCaseConstant now ignore type declarations
    • These sniffs now only report errors for true/false/null when used as values
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.PHP.LowerCaseType now supports the PHP 8.1 never type
Fixed
  • Fixed bug #​3502 : A match statement within an array produces Squiz.Arrays.ArrayDeclaration.NoKeySpecified
  • Fixed bug #​3503 : Squiz.Commenting.FunctionComment.ThrowsNoFullStop false positive when one line @​throw
  • Fixed bug #​3505 : The nullsafe operator is not counted in Generic.Metrics.CyclomaticComplexity
  • Fixed bug #​3526 : PSR12.Properties.ConstantVisibility false positive when using public final const syntax
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3530 : Line indented incorrectly false positive when using match-expression inside switch case
  • Fixed bug #​3534 : Name of typed enum tokenized as T_GOTO_LABEL
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3546 : Tokenizer/PHP: bug fix - parent/static keywords in class instantiations
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3550 : False positive from PSR2.ControlStructures.SwitchDeclaration.TerminatingComment when using trailing comment
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3575 : Squiz.Scope.MethodScope misses visibility keyword on previous line
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3604 : Tokenizer/PHP: bug fix for double quoted strings using ${
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.6.2

Compare Source

Changed
  • Processing large code bases that use tab indenting inside comments and strings will now be faster
Fixed
  • Fixed bug #​3388 : phpcs does not work when run from WSL drives
  • Fixed bug #​3422 : Squiz.WhiteSpace.ScopeClosingBrace fixer removes HTML content when fixing closing brace alignment
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3437 : PSR12 does not forbid blank lines at the start of the class body
    • Added new PSR12.Classes.OpeningBraceSpace sniff to enforce this
  • Fixed bug #​3440 : Squiz.WhiteSpace.MemberVarSpacing false positives when attributes used without docblock
    • Thanks to [Vadim Borodavko][@​javer] for the patch
  • Fixed bug #​3448 : PHP 8.1 deprecation notice while generating running time value
  • Fixed bug #​3456 : PSR12.Classes.ClassInstantiation.MissingParentheses false positive using attributes on anonymous class
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3460 : Generic.Formatting.MultipleStatementAlignment false positive on closure with parameters
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3468 : do/while loops are double-counted in Generic.Metrics.CyclomaticComplexity
  • Fixed bug #​3469 : Ternary Operator and Null Coalescing Operator are not counted in Generic.Metrics.CyclomaticComplexity
  • Fixed bug #​3472 : PHP 8 match() expression is not counted in Generic.Metrics.CyclomaticComplexity

v3.6.1

Compare Source

Changed
  • PHPCS annotations can now be specified using hash-style comments
    • Previously, only slash-style and block-style comments could be used to do things like disable errors
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The new PHP 8.1 tokenization for ampersands has been reverted to use the existing PHP_CodeSniffer method
    • The PHP 8.1 tokens T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG and T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG are unused
    • Ampersands continue to be tokenized as T_BITWISE_AND for all PHP versions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] and [Anna Filina][@​afilina] for the patch
  • File::getMethodParameters() no longer incorrectly returns argument attributes in the type hint array index
    • A new has_attributes array index is available and set to TRUE if the argument has attributes defined
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed an issue where some sniffs would not run on PHP files that only used the short echo tag
    • The following sniffs were affected:
      • Generic.Files.ExecutableFile
      • Generic.Files.LowercasedFilename
      • Generic.Files.LineEndings
      • Generic.Files.EndFileNewline
      • Generic.Files.EndFileNoNewline
      • Generic.PHP.ClosingPHPTag
      • Generic.PHP.Syntax
      • Generic.VersionControl.GitMergeConflict
      • Generic.WhiteSpace.DisallowSpaceIndent
      • Generic.WhiteSpace.DisallowTabIndent
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Squiz.Commenting.BlockComment now correctly applies rules for block comments after a short echo tag
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Fixed
  • Generic.NamingConventions.ConstructorName no longer throws deprecation notices on PHP 8.1
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed false positives when using attributes in the following sniffs:
    • PEAR.Commenting.FunctionComment
    • Squiz.Commenting.InlineComment
    • Squiz.Commenting.BlockComment
    • Squiz.Commenting.VariableComment
    • Squiz.WhiteSpace.MemberVarSpacing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3294 : Bug in attribute tokenization when content contains PHP end token or attribute closer on new line
    • Thanks to [Alessandro Chitolina][@​alekitto] for the patch
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the tests
  • Fixed bug #​3296 : PSR2.ControlStructures.SwitchDeclaration takes phpcs:ignore as content of case body
  • Fixed bug #​3297 : PSR2.ControlStructures.SwitchDeclaration.TerminatingComment does not handle try/finally blocks
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3302 : PHP 8.0 | Tokenizer/PHP: bugfix for union types using namespace operator
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3303 : findStartOfStatement() doesn't work with T_OPEN_TAG_WITH_ECHO
  • Fixed bug #​3316 : Arrow function not tokenized correctly when using null in union type
  • Fixed bug #​3317 : Problem with how phpcs handles ignored files when running in parallel
  • Fixed bug #​3324 : PHPCS hangs processing some nested arrow functions inside a function call
  • Fixed bug #​3326 : Generic.Formatting.MultipleStatementAlignment error with const DEFAULT
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3333 : Squiz.Objects.ObjectInstantiation: null coalesce operators are not recognized as assignment
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3340 : Ensure interface and trait names are always tokenized as T_STRING
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3342 : PSR12/Squiz/PEAR standards all error on promoted properties with docblocks
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3345 : IF statement with no braces and double catch turned into syntax error by auto-fixer
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3352 : PSR2.ControlStructures.SwitchDeclaration can remove comments on the same line as the case statement while fixing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3357 : Generic.Functions.OpeningFunctionBraceBsdAllman removes return type when additional lines are present
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3362 : Generic.WhiteSpace.ScopeIndent false positive for arrow functions inside arrays
  • Fixed bug #​3384 : Squiz.Commenting.FileComment.SpacingAfterComment false positive on empty file
  • Fixed bug #​3394 : Fix PHP 8.1 auto_detect_line_endings deprecation notice
  • Fixed bug #​3400 : PHP 8.1: prevent deprecation notices about missing return types
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3424 : PHPCS fails when using PHP 8 Constructor property promotion with attributes
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3425 : PHP 8.1 | Runner::processChildProcs(): fix passing null to non-nullable bug
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3445 : Nullable parameter after attribute incorrectly tokenized as ternary operator
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.6.0

Compare Source

Added
  • Added support for PHP 8.0 union types
    • A new T_TYPE_UNION token is available to represent the pipe character
    • File::getMethodParameters(), getMethodProperties(), and getMemberProperties() will now return union types
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.0 named function call arguments
    • A new T_PARAM_NAME token is available to represent the label with the name of the function argument in it
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.0 attributes
    • The PHP-supplied T_ATTRIBUTE token marks the start of an attribute
    • A new T_ATTRIBUTE_END token is available to mark the end of an attribute
    • New attribute_owner and attribute_closer indexes are available in the tokens array for all tokens inside an attribute
    • Tokenizing of attributes has been backfilled for older PHP versions
    • The following sniffs have been updated to support attributes:
      • PEAR.Commenting.ClassComment
      • PEAR.Commenting.FileComment
      • PSR1.Files.SideEffects
      • PSR12.Files.FileHeader
      • Squiz.Commenting.ClassComment
      • Squiz.Commenting.FileComment
      • Squiz.WhiteSpace.FunctionSpacing
        • Thanks to [Vadim Borodavko][@​javer] for the patch
    • Thanks to [Alessandro Chitolina][@​alekitto] for the patch
  • Added support for PHP 8.0 dereferencing of text strings with interpolated variables
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for PHP 8.0 match expressions
    • Match expressions are now tokenized with parenthesis and scope openers and closers
      • Sniffs can listen for the T_MATCH token to process match expressions
      • Note that the case and default statements inside match expressions do not have scopes set
    • A new T_MATCH_ARROW token is available to represent the arrows in match expressions
    • A new T_MATCH_DEFAULT token is available to represent the default keyword in match expressions
    • All tokenizing of match expressions has been backfilled for older PHP versions
    • The following sniffs have been updated to support match expressions:
      • Generic.CodeAnalysis.AssignmentInCondition
      • Generic.CodeAnalysis.EmptyPHPStatement
        • Thanks to [Vadim Borodavko][@​javer] for the patch
      • Generic.CodeAnalysis.EmptyStatement
      • Generic.PHP.LowerCaseKeyword
      • PEAR.ControlStructures.ControlSignature
      • PSR12.ControlStructures.BooleanOperatorPlacement
      • Squiz.Commenting.LongConditionClosingComment
      • Squiz.Commenting.PostStatementComment
      • Squiz.ControlStructures.LowercaseDeclaration
      • Squiz.ControlStructures.ControlSignature
      • Squiz.Formatting.OperatorBracket
      • Squiz.PHP.DisallowMultipleAssignments
      • Squiz.Objects.ObjectInstantiation
      • Squiz.WhiteSpace.ControlStructureSpacing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added Generic.NamingConventions.AbstractClassNamePrefix to enforce that class names are prefixed with "Abstract"
    • Thanks to [Anna Borzenko][@​annechko] for the contribution
  • Added Generic.NamingConventions.InterfaceNameSuffix to enforce that interface names are suffixed with "Interface"
    • Thanks to [Anna Borzenko][@​annechko] for the contribution
  • Added Generic.NamingConventions.TraitNameSuffix to enforce that trait names are suffixed with "Trait"
    • Thanks to [Anna Borzenko][@​annechko] for the contribution
Changed
  • The value of the T_FN_ARROW token has changed from "T_FN_ARROW" to "PHPCS_T_FN_ARROW" to avoid package conflicts
    • This will have no impact on custom sniffs unless they are specifically looking at the value of the T_FN_ARROW constant
    • If sniffs are just using constant to find arrow functions, they will continue to work without modification
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • File::findStartOfStatement() now works correctly when passed the last token in a statement
  • File::getMethodParameters() now supports PHP 8.0 constructor property promotion
    • Returned method params now include a "property_visibility" and "visibility_token" index if property promotion is detected
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • File::getMethodProperties() now includes a "return_type_end_token" index in the return value
    • This indicates the last token in the return type, which is helpful when checking union types
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Include patterns are now ignored when processing STDIN
    • Previously, checks using include patterns were excluded when processing STDIN when no file path was provided via --stdin-path
    • Now, all include and exclude rules are ignored when no file path is provided, allowing all checks to run
    • If you want include and exclude rules enforced when checking STDIN, use --stdin-path to set the file path
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Spaces are now correctly escaped in the paths to external on Windows
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.CodeAnalysis.UnusedFunctionParameter can now be configured to ignore variable usage for specific type hints
    • This allows you to suppress warnings for some variables that are not required, but leave warnings for others
    • Set the ignoreTypeHints array property to a list of type hints to ignore
    • Thanks to [Petr Bugyík][@​o5] for the patch
  • Generic.Formatting.MultipleStatementAlignment can now align statements at the start of the assignment token
    • Previously, the sniff enforced that the values were aligned, even if this meant the assignment tokens were not
    • Now, the sniff can enforce that the assignment tokens are aligned, even if this means the values are not
    • Set the "alignAtEnd" sniff property to "false" to align the assignment tokens
    • The default remains at "true", so the assigned values are aligned
    • Thanks to [John P. Bloch][@​johnpbloch] for the patch
  • Generic.PHP.LowerCaseType now supports checking of typed properties
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.PHP.LowerCaseType now supports checking of union types
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • PEAR.Commenting.FunctionComment and Squiz.Commenting.FunctionComment sniffs can now ignore private and protected methods
    • Set the "minimumVisibility" sniff property to "protected" to ignore private methods
    • Set the "minimumVisibility" sniff property to "public" to ignore both private and protected methods
    • The default remains at "private", so all methods are checked
    • Thanks to [Vincent Langlet][@​VincentLanglet] for the patch
  • PEAR.Commenting.FunctionComment and Squiz.Commenting.FunctionComment sniffs can now ignore return tags in any method
    • Previously, only __construct() and __destruct() were ignored
    • Set the list of method names to ignore in the "specialMethods" sniff property
    • The default remains at "__construct" and "__destruct" only
    • Thanks to [Vincent Langlet][@​VincentLanglet] for the patch
  • PSR2.ControlStructures.SwitchDeclaration now supports nested switch statements where every branch terminates
    • Previously, if a CASE only contained a SWITCH and no direct terminating statement, a fall-through error was displayed
    • Now, the error is suppressed if every branch of the SWITCH has a terminating statement
    • Thanks to [Vincent Langlet][@​VincentLanglet] for the patch
  • The PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket error message is now reported on the closing parenthesis token
    • Previously, the error was being reported on the function keyword, leading to confusing line numbers in the error report
  • Squiz.Commenting.FunctionComment is now able to ignore function comments that are only inheritdoc statements
    • Set the skipIfInheritdoc sniff property to "true" to skip checking function comments if the content is only {@​inhertidoc}
    • The default remains at "false", so these comments will continue to report errors
    • Thanks to [Jess Myrbo][@​xjm] for the patch
  • Squiz.Commenting.FunctionComment now supports the PHP 8 mixed type
    • Thanks to [Vadim Borodavko][@​javer] for the patch
  • Squiz.PHP.NonExecutableCode now has improved handling of syntax errors
  • Squiz.WhiteSpace.ScopeKeywordSpacing now checks spacing when using PHP 8.0 constructor property promotion
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Fixed
  • Fixed an issue that could occur when checking files on network drives, such as with WSL2 on Windows 10
    • This works around a long-standing PHP bug with is_readable()
    • Thanks to [Michael S][@​codebymikey] for the patch
  • Fixed a number of false positives in the Squiz.PHP.DisallowMultipleAssignments sniff
    • Sniff no longer errors for default value assignments in arrow functions
    • Sniff no longer errors for assignments on first line of closure
    • Sniff no longer errors for assignments after a goto label
    • Thanks to [Jaroslav Hanslík][@​kukulich] for the patch
  • Fixed bug #​2913 : Generic.WhiteSpace.ScopeIndent false positive when opening and closing tag on same line inside conditional
  • Fixed bug #​2992 : Enabling caching using a ruleset produces invalid cache files when using --sniffs and --exclude CLI args
  • Fixed bug #​3003 : Squiz.Formatting.OperatorBracket autofix incorrect when assignment used with null coalescing operator
  • Fixed bug #​3145 : Autoloading of sniff fails when multiple classes declared in same file
  • Fixed bug #​3157 : PSR2.ControlStructures.SwitchDeclaration.BreakIndent false positive when case keyword is not indented
  • Fixed bug #​3163 : Undefined index error with pre-commit hook using husky on PHP 7.4
  • Fixed bug #​3165 : Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure
  • Fixed bug #​3167 : Generic.WhiteSpace.ScopeIndent false positive when using PHP 8.0 constructor property promotion
  • Fixed bug #​3170 : Squiz.WhiteSpace.OperatorSpacing false positive when using negation with string concat
    • This also fixes the same issue in the PSR12.Operators.OperatorSpacing sniff
  • Fixed bug #​3177 : Incorrect tokenization of GOTO statements in mixed PHP/HTML files
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3184 : PSR2.Namespace.NamespaceDeclaration false positive on namespace operator
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3188 : Squiz.WhiteSpace.ScopeKeywordSpacing false positive for static return type
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3192 : findStartOfStatement doesn't work correctly inside switch
  • Fixed bug #​3195 : Generic.WhiteSpace.ScopeIndent confusing message when combination of tabs and spaces found
  • Fixed bug #​3197 : Squiz.NamingConventions.ValidVariableName does not use correct error code for all member vars
  • Fixed bug #​3219 : Generic.Formatting.MultipleStatementAlignment false positive for empty anonymous classes and closures
  • Fixed bug #​3258 : Squiz.Formatting.OperatorBracket duplicate error messages for unary minus
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3273 : Squiz.Functions.FunctionDeclarationArgumentSpacing reports line break as 0 spaces between parenthesis
  • Fixed bug #​3277 : Nullable static return typehint causes whitespace error
  • Fixed bug #​3284 : Unused parameter false positive when using array index in arrow function

v3.5.8

Compare Source

Removed
  • Reverted a change to the way include/exclude patterns are processed for STDIN content
    • This change is not backwards compatible and will be re-introduced in version 3.6.0

v3.5.7

Compare Source

Added
  • The PHP 8.0 T_NULLSAFE_OBJECT_OPERATOR token has been made available for older versions
    • Existing sniffs that check for T_OBJECT_OPERATOR have been modified to apply the same rules for the nullsafe object operator
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The new method of PHP 8.0 tokenizing for namespaced names has been reverted to the pre 8.0 method
    • This maintains backwards compatible for existing sniffs on PHP 8.0
    • This change will be removed in PHPCS 4.0 as the PHP 8.0 tokenizing method will be backported for pre 8.0 versions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for changes to the way PHP 8.0 tokenizes hash comments
    • The existing PHP 5-7 behaviour has been replicated for version 8, so no sniff changes are required
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Running the unit tests now includes warnings in the found and fixable error code counts
    - Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • PSR12.Functions.NullableTypeDeclaration now supports the PHP8 static return type
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Changed
  • The autoloader has been changed to fix sniff class name detection issues that may occur when running on PHP 7.4+
  • PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed error message is now more accurate when using the allowOnly setting
Fixed
  • Fixed Squiz.Formatting.OperatorBracket false positive when exiting with a negative number
  • Fixed Squiz.PHP.DisallowComparisonAssignment false positive for methods called on an object
  • Fixed bug #​2882 : Generic.Arrays.ArrayIndent can request close brace indent to be less than the statement indent level
  • Fixed bug #​2883 : Generic.WhiteSpace.ScopeIndent.Incorrect issue after NOWDOC
  • Fixed bug #​2975 : Undefined offset in PSR12.Functions.ReturnTypeDeclaration when checking function return type inside ternary
  • Fixed bug #​2988 : Undefined offset in Squiz.Strings.ConcatenationSpacing during live coding
  • Fixed bug #​2989 : Incorrect auto-fixing in Generic.ControlStructures.InlineControlStructure during live coding
  • Fixed bug #​3007 : Directory exclude pattern improperly excludes directories with names that start the same
  • Fixed bug #​3043 : Squiz.WhiteSpace.OperatorSpacing false positive for negation in arrow function
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3049 : Incorrect error with arrow function and parameter passed as reference
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3053 : PSR2 incorrect fix when multiple use statements on same line do not have whitespace between them
  • Fixed bug #​3058 : Progress gets unaligned when 100% happens at the end of the available dots
  • Fixed bug #​3059 : Squiz.Arrays.ArrayDeclaration false positive when using type casting
    • Thanks to [Sergei Morozov][@​morozov] for the patch
  • Fixed bug #​3060 : Squiz.Arrays.ArrayDeclaration false positive for static functions
    • Thanks to [Sergei Morozov][@​morozov] for the patch
  • Fixed bug #​3065 : Should not fix Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma if comment between element and comma
    • Thanks to [Sergei Morozov][@​morozov] for the patch
  • Fixed bug #​3066 : No support for namespace operator used in type declarations
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3075 : PSR12.ControlStructures.BooleanOperatorPlacement false positive when operator is the only content on line
  • Fixed bug #​3099 : Squiz.WhiteSpace.OperatorSpacing false positive when exiting with negative number
    • Thanks to [Sergei Morozov][@​morozov] for the patch
  • Fixed bug #​3102 : PSR12.Squiz.OperatorSpacing false positive for default values of arrow functions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​3124 : PSR-12 not reporting error for empty lines with only whitespace
  • Fixed bug #​3135 : Ignore annotations are broken on PHP 8.0
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

v3.5.6

Compare Source

Added
  • Added support for PHP 8.0 magic constant dereferencing
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Added support for changes to the way PHP 8.0 tokenizes comments
    • The existing PHP 5-7 behaviour has been replicated for version 8, so no sniff changes are required
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • File::getMethodProperties() now detects the PHP 8.0 static return type
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • The PHP 8.0 static return type is now supported for arrow functions
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
Changed
  • The cache is no longer used if the list of loaded PHP extensions changes
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Generic.NamingConventions.CamelCapsFunctionName no longer reports __serialize and __unserialize as invalid names
  • PEAR.NamingConventions.ValidFunctionName no longer reports __serialize and __unserialize as invalid names
  • Squiz.Scope.StaticThisUsage now detects usage of $this inside closures and arrow functions
Fixed
  • Fixed bug #​2877 : PEAR.Functions.FunctionCallSignature false positive for array of functions
  • Fixed bug #​2888 : PSR12.Files.FileHeader blank line error with multiple namespaces in one file
  • Fixed bug #​2926 : phpcs hangs when using arrow functions that return heredoc
  • Fixed bug #​2943 : Redundant semicolon added to a file when fixing PSR2.Files.ClosingTag.NotAllowed
  • Fixed bug #​2967 : Markdown generator does not output headings correctly
    • Thanks to [Petr Bugyík][@​o5] for the patch
  • Fixed bug #​2977 : File::isReference() does not detect return by reference for closures
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch
  • Fixed bug #​2994 : Generic.Formatting.DisallowMultipleStatements false positive for FOR loop with no body
  • Fixed bug #​3033 : Error generated during tokenizing of goto statements on PHP 8
    • Thanks to [Juliette Reinders Folmer][@​jrfnl] for the patch

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) | require-dev | minor | `3.5.5` -> `3.11.3` | --- ### Release Notes <details> <summary>PHPCSStandards/PHP_CodeSniffer (squizlabs/php_codesniffer)</summary> ### [`v3.11.3`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3113---2025-01-23) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.2...3.11.3) ##### Changed - Generic.ControlStructures.InlineControlStructure no longer unnecessarily listens for T_SWITCH tokens. [#&#8203;595] - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Squiz.Functions.FunctionDeclarationArgumentSpacing: improvements to error message for `SpaceBeforeComma` error. [#&#8203;783] - The following sniff(s) have received efficiency improvements: - Squiz.Functions.FunctionDeclarationArgumentSpacing - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Michał Bundyra]\[[@&#8203;michalbundyra](https://github.com/michalbundyra)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;620] : Squiz.Functions.FunctionDeclarationArgumentSpacing: newlines after type will now be handled by the fixer. This also prevents a potential fixer conflict. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch. - Fixed bug [#&#8203;782] : Tokenizer/PHP: prevent an "Undefined array key" notice during live coding for unfinished arrow functions. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line after reference token was not flagged nor fixed. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line after variadic token was not flagged nor fixed. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: new line before/after the equal sign for default values was not flagged nor fixed when `equalsSpacing` was set to `0`. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer conflict when a new line is found before/after the equal sign for default values and `equalsSpacing` was set to `1`. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer for spacing before/after equal sign could inadvertently remove comment. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;783] : Squiz.Functions.FunctionDeclarationArgumentSpacing: fixer will now handle comments between the end of a parameter and a comma more cleanly. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;784] : Squiz.WhiteSpace.FunctionSpacing: prevent fixer conflict when a multi-line docblock would start on the same line as the function close curly being examined. - Thanks to \[Klaus Purer]\[[@&#8203;klausi](https://github.com/klausi)] for the patch [#&#8203;595]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/595 [#&#8203;620]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/620 [#&#8203;782]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/782 [#&#8203;783]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/783 [#&#8203;784]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/784 ### [`v3.11.2`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3112---2024-12-11) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.1...3.11.2) ##### Changed - Generators/HTML + Markdown: the output will now be empty (no page header/footer) when there are no docs to display. [#&#8203;687] - This is in line with the Text Generator which already didn't produce output if there are no docs. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Generators/HTML: only display a Table of Contents when there is more than one sniff with documentation. [#&#8203;697] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Generators/HTML: improved handling of line breaks in `<standard>` blocks. [#&#8203;723] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Generators/Markdown: improved compatibility with the variety of available markdown parsers. [#&#8203;722] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Generators/Markdown: improved handling of line breaks in `<standard>` blocks. [#&#8203;737] - This prevents additional paragraphs from being displayed as code blocks. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Generic.NamingConventions.UpperCaseConstantName: the exact token containing the non-uppercase constant name will now be identified with more accuracy. [#&#8203;665] - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Generic.Functions.OpeningFunctionBraceKernighanRitchie: minor improvement to the error message wording. [#&#8203;736] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;527] : Squiz.Arrays.ArrayDeclaration: short lists within a foreach condition should be ignored. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;665] : Generic.NamingConventions.UpperCaseConstantName: false positives and false negatives when code uses unconventional spacing and comments when calling `define()`. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;665] : Generic.NamingConventions.UpperCaseConstantName: false positive when a constant named `DEFINE` is encountered. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;665] : Generic.NamingConventions.UpperCaseConstantName: false positive for attribute class called `define`. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;665] : Generic.NamingConventions.UpperCaseConstantName: false positive when handling the instantiation of a class named `define`. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;688] : Generators/Markdown could leave error_reporting in an incorrect state. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;698] : Generators/Markdown : link in the documentation footer would not parse as a link. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;738] : Generators/Text: stray blank lines after code sample titles. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;739] : Generators/HTML + Markdown: multi-space whitespace within a code sample title was folded into a single space. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. [#&#8203;527]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/527 [#&#8203;665]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/665 [#&#8203;687]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/687 [#&#8203;688]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/688 [#&#8203;697]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/697 [#&#8203;698]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/698 [#&#8203;722]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/722 [#&#8203;723]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/723 [#&#8203;736]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/736 [#&#8203;737]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/737 [#&#8203;738]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/738 [#&#8203;739]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/739 ### [`v3.11.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3111---2024-11-16) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.0...3.11.1) ##### Changed - Output from the `--generator=...` feature will respect the OS-expected EOL char in more places. [#&#8203;671] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Bartosz Dziewoński]\[[@&#8203;MatmaRex](https://github.com/MatmaRex)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;674] : Generic.WhiteSpace.HereNowdocIdentifierSpacing broken XML documentation - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Fixed bug [#&#8203;675] : InvalidArgumentException when a ruleset includes a sniff by file name and the included sniff does not comply with the PHPCS naming conventions. - Notwithstanding this fix, it is strongly recommended to ensure custom sniff classes comply with the PHPCS naming conventions. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. [#&#8203;671]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/671 [#&#8203;674]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/674 [#&#8203;675]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/675 ### [`v3.11.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3110---2024-11-12) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.3...3.11.0) ##### Added - Runtime support for PHP 8.4. All known PHP 8.4 deprecation notices have been fixed. - Syntax support for new PHP 8.4 features will follow in a future release. - If you find any PHP 8.4 deprecation notices which were missed, please report them. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches. - Tokenizer support for PHP 8.3 "yield from" expressions with a comment between the keywords. [#&#8203;529], [#&#8203;647] - Sniffs explicitly handling T_YIELD_FROM tokens may need updating. The PR description contains example code for use by sniff developers. - Additionally, the following sniff has been updated to support "yield from" expressions with comments: - Generic.WhiteSpace.LanguageConstructSpacing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - New `Generic.WhiteSpace.HereNowdocIdentifierSpacing` sniff. [#&#8203;586], [#&#8203;637] - Forbid whitespace between the `<<<` and the identifier string in heredoc/nowdoc start tokens. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - New `Generic.Strings.UnnecessaryHeredoc` sniff. [#&#8203;633] - Warns about heredocs without interpolation or expressions in the body text and can auto-fix these to nowdocs. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Documentation for the following sniffs: - Generic.Arrays.ArrayIndent - Squiz.PHP.Heredoc - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches. ##### Changed - The Common::getSniffCode() method will now throw an InvalidArgumentException exception if an invalid `$sniffClass` is passed. [#&#8203;524], [#&#8203;625] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Documentation generated using the `--generator=...` feature will now always be presented in natural order based on the sniff name(s). [#&#8203;668] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Minor improvements to the display of runtime information. [#&#8203;658] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Squiz.Commenting.PostStatementComment: trailing annotations in PHP files will now be reported under a separate, non-auto-fixable error code `AnnotationFound`. [#&#8203;560], [#&#8203;627] - This prevents (tooling related) annotations from taking on a different meaning when moved by the fixer. - The separate error code also allows for selectively excluding it to prevent the sniff from triggering on trailing annotations, while still forbidding other trailing comments. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Squiz.ControlStructures.ForEachLoopDeclaration: the `SpacingAfterOpen` error code has been replaced by the `SpaceAfterOpen` error code. The latter is a pre-existing code. The former appears to have been a typo. [#&#8203;582] - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch. - The following sniff(s) have received efficiency improvements: - Generic.Classes.DuplicateClassName - Generic.NamingConventions.ConstructorName - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;3808][sq-3808] : Generic.WhiteSpace.ScopeIndent would throw false positive for tab indented multi-token yield from expression. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;630] : The tokenizer could inadvertently transform "normal" parentheses to DNF parentheses, when a function call was preceded by a switch-case / alternative syntax control structure colon. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;645] : On PHP 5.4, if yield was used as the declaration name for a function declared to return by reference, the function name would incorrectly be tokenized as T_YIELD instead of T_STRING. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;647] : Tokenizer not applying tab replacement in single token "yield from" keywords. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;647] : Generic.WhiteSpace.DisallowSpaceIndent did not flag space indentation in multi-line yield from. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;647] : Generic.WhiteSpace.DisallowTabIndent did not flag tabs inside yield from. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;652] : Generic.NamingConventions.ConstructorName: false positives for PHP-4 style calls to PHP-4 style parent constructor when a method with the same name as the parent class was called on another class. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;652] : Generic.NamingConventions.ConstructorName: false negatives for PHP-4 style calls to parent constructor for function calls with whitespace and comments in unconventional places. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;653] : Generic.Classes.DuplicateClassName : the sniff did not skip namespace keywords used as operators, which could lead to false positives. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;653] : Generic.Classes.DuplicateClassName : sniff going into an infinite loop during live coding. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;653] : Generic.Classes.DuplicateClassName : false positives/negatives when a namespace declaration contained whitespace or comments in unconventional places. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;653] : Generic.Classes.DuplicateClassName : namespace for a file going in/out of PHP was not remembered/applied correctly. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-3808]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3808 [#&#8203;524]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/524 [#&#8203;529]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/529 [#&#8203;560]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/560 [#&#8203;582]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/582 [#&#8203;586]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/586 [#&#8203;625]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/625 [#&#8203;627]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/627 [#&#8203;630]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/630 [#&#8203;633]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/633 [#&#8203;637]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/637 [#&#8203;645]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/645 [#&#8203;647]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/647 [#&#8203;652]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/652 [#&#8203;653]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/653 [#&#8203;658]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/658 [#&#8203;668]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/668 ### [`v3.10.3`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3103---2024-09-18) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.2...3.10.3) ##### Changed - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;553] : Squiz.Classes.SelfMemberReference: false negative(s) when namespace operator was encountered between the namespace declaration and the OO declaration. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;579] : AbstractPatternSniff: potential PHP notice during live coding. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;580] : Squiz.Formatting.OperatorBracket: potential PHP notice during live coding. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;581] : PSR12.ControlStructures.ControlStructureSpacing: prevent fixer conflict by correctly handling multiple empty newlines before the first condition in a multi-line control structure. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch. - Fixed bug [#&#8203;585] : Tokenizer not applying tab replacement in heredoc/nowdoc openers. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;588] : Squiz.PHP.EmbeddedPhp false positive when checking spaces after a PHP short open tag. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;597] : Generic.PHP.LowerCaseKeyword did not flag nor fix non-lowercase anonymous class keywords. - Thanks to \[Marek Štípek]\[[@&#8203;maryo](https://github.com/maryo)] for the patch. - Fixed bug [#&#8203;598] : Squiz.PHP.DisallowMultipleAssignments: false positive on assignments to variable property on object stored in array. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;608] : Squiz.Functions.MultiLineFunctionDeclaration did not take (parameter) attributes into account when checking for one parameter per line. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Other - The provenance of PHAR files associated with a release can now be verified via [GitHub Artifact Attestations][ghattest] using the [GitHub CLI tool][ghcli] with the following command: `gh attestation verify [phpcs|phpcbf].phar -o PHPCSStandards`. [#&#8203;574] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. [#&#8203;553]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/553 [#&#8203;574]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/574 [#&#8203;579]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/579 [#&#8203;580]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/580 [#&#8203;581]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/581 [#&#8203;585]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/585 [#&#8203;588]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/588 [#&#8203;597]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/597 [#&#8203;598]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/598 [#&#8203;608]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/608 [ghcli]: https://cli.github.com/ [ghattest]: https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds ### [`v3.10.2`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3102---2024-07-22) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.1...3.10.2) ##### Changed - The following sniff(s) have received efficiency improvements: - Generic.Functions.FunctionCallArgumentSpacing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - The array format of the information passed to the `Reports::generateFileReport()` method is now documented in the Reports interface. [#&#8203;523] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Bill Ruddock]\[[@&#8203;biinari](https://github.com/biinari)], \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)], \[Klaus Purer]\[[@&#8203;klausi](https://github.com/klausi)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;513] : Generic.Functions.FunctionCallArgumentSpacing did not ignore the body of a match expressions passed as a function argument, which could lead to false positives. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;533] : Generic.WhiteSpace.DisallowTabIndent: tab indentation for heredoc/nowdoc closers will no longer be auto-fixed to prevent parse errors. The issue will still be reported. - The error code for heredoc/nowdoc indentation using tabs has been made more specific - `TabsUsedHeredocCloser` - to allow for selectively excluding the indentation check for heredoc/nowdoc closers. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;534] : Generic.WhiteSpace.DisallowSpaceIndent did not report on space indentation for PHP 7.3 flexible heredoc/nowdoc closers. - Closers using space indentation will be reported with a dedicated error code: `SpacesUsedHeredocCloser`. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;537] : Squiz.PHP.DisallowMultipleAssignments false positive for list assignments at the start of a new PHP block after an embedded PHP statement. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;551] : Squiz.PHP.DisallowMultipleAssignments prevent false positive for function parameters during live coding. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;554] : Generic.CodeAnalysis.UselessOverridingMethod edge case false negative when the call to the parent method would end on a PHP close tag. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;555] : Squiz.Classes.SelfMemberReference edge case false negative when the namespace declaration would end on a PHP close tag. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [#&#8203;513]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/513 [#&#8203;523]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/523 [#&#8203;533]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/533 [#&#8203;534]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/534 [#&#8203;537]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/537 [#&#8203;551]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/551 [#&#8203;554]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/554 [#&#8203;555]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/555 ### [`v3.10.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3101---2024-05-22) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.0...3.10.1) ##### Added - Documentation for the following sniffs: - Generic.Commenting.DocComment - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. ##### Changed - The following have received efficiency improvements: - Type handling in the PHP Tokenizer - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;110], [#&#8203;437], [#&#8203;475] : `File::findStartOfStatement()`: the start of statement/expression determination for tokens in parentheses/short array brackets/others scopes, nested within match expressions, was incorrect in most cases. The trickle down effect of the bug fixes made to the `File::findStartOfStatement()` method, is that the Generic.WhiteSpace.ScopeIndent and the PEAR.WhiteSpace.ScopeIndent sniffs should now be able to correctly determine and fix the indent for match expressions containing nested expressions. These fixes also fix an issue with the `Squiz.Arrays.ArrayDeclaration` sniff and possibly other, unreported bugs. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;504] : The tokenizer could inadvertently mistake the last parameter in a function call using named arguments for a DNF type. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;508] : Tokenizer/PHP: extra hardening against handling parse errors in the type handling layer. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [#&#8203;110]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/110 [#&#8203;437]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/437 [#&#8203;475]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/475 [#&#8203;504]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/504 [#&#8203;508]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/508 ### [`v3.10.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#3100---2024-05-20) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.2...3.10.0) ##### Added - Tokenizer support for PHP 8.2 Disjunctive Normal Form (DNF) types. [#&#8203;3731][sq-3731], [#&#8203;387], [#&#8203;461] - Includes new `T_TYPE_OPEN_PARENTHESIS` and `T_TYPE_CLOSE_PARENTHESIS` tokens to represent the parentheses in DNF types. - These new tokens, like other parentheses, will have the `parenthesis_opener` and `parenthesis_closer` token array indexes set and the tokens between them will have the `nested_parenthesis` index. - The `File::getMethodProperties()`, `File::getMethodParameters()` and `File::getMemberProperties()` methods now all support DNF types. [#&#8203;471], [#&#8203;472], [#&#8203;473] - Additionally, the following sniff has been updated to support DNF types: - Generic.PHP.LowerCaseType [#&#8203;478] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches. - Documentation for the following sniffs: - Squiz.WhiteSpace.FunctionClosingBraceSpace - Thanks to \[Przemek Hernik]\[[@&#8203;przemekhernik](https://github.com/przemekhernik)] for the patch. ##### Changed - The help screens have received a face-lift for improved usability and readability. [#&#8203;447] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch and thanks to \[Colin Stewart]\[[@&#8203;costdev](https://github.com/costdev)], \[Gary Jones]\[[@&#8203;GaryJones](https://github.com/GaryJones)] and \[[@&#8203;mbomb007](https://github.com/mbomb007)] for reviewing. - The Squiz.Commenting.ClosingDeclarationComment sniff will now also examine and flag closing comments for traits. [#&#8203;442] - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - The following sniff(s) have efficiency improvements: - Generic.Arrays.ArrayIndent - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - The autoloader will now always return a boolean value indicating whether it has loaded a class or not. [#&#8203;479] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)], \[Danny van der Sluijs]\[[@&#8203;DannyvdSluijs](https://github.com/DannyvdSluijs)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;466] : Generic.Functions.CallTimePassByReference was not flagging call-time pass-by-reference in class instantiations using the self/parent/static keywords. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;494] : edge case bug in tokenization of an empty block comment. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;494] : edge case bug in tokenization of an empty single-line DocBlock. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;499] : Generic.ControlStructures.InlineControlStructure now handles statements with a comment between `else` and `if` correctly. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. [sq-3731]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3731 [#&#8203;387]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/387 [#&#8203;442]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/442 [#&#8203;447]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/447 [#&#8203;461]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/461 [#&#8203;466]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/466 [#&#8203;471]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/471 [#&#8203;472]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/472 [#&#8203;473]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/473 [#&#8203;478]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/478 [#&#8203;479]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/479 [#&#8203;494]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/494 [#&#8203;499]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/499 ### [`v3.9.2`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#392---2024-04-24) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.1...3.9.2) ##### Changed - The Generic.ControlStructures.DisallowYodaConditions sniff no longer listens for the null coalesce operator. [#&#8203;458] - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;381] : Squiz.Commenting.ClosingDeclarationComment could throw the wrong error when the close brace being examined is at the very end of a file. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;385] : Generic.CodeAnalysis.JumbledIncrementer improved handling of parse errors/live coding. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;394] : Generic.Functions.CallTimePassByReference was not flagging call-time pass-by-reference in anonymous class instantiations - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;420] : PEAR.Functions.FunctionDeclaration could run into a blocking PHP notice while fixing code containing a parse error. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;421] : File::getMethodProperties() small performance improvement & more defensive coding. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;423] : PEAR.WhiteSpace.ScopeClosingBrace would have a fixer conflict with itself when a close tag was preceded by non-empty inline HTML. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;424] : PSR2.Classes.ClassDeclaration using namespace relative interface names in the extends/implements part of a class declaration would lead to a fixer conflict. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;427] : Squiz.Operators.OperatorSpacing would have a fixer conflict with itself when an operator was preceeded by a new line and the previous line ended in a comment. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;430] : Squiz.ControlStructures.ForLoopDeclaration: fixed potential undefined array index notice - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;431] : PSR2.Classes.ClassDeclaration will no longer try to auto-fix multi-line interface implements statements if these are interlaced with comments on their own line. This prevents a potential fixer conflict. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;453] : Arrow function tokenization was broken when the return type was a stand-alone `true` or `false`; or contained `true` or `false` as part of a union type. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Other - [ESLint 9.0] has been released and changes the supported configuration file format. The (deprecated) `Generic.Debug.ESLint` sniff only supports the "old" configuration file formats and when using the sniff to run ESLint, the `ESLINT_USE_FLAT_CONFIG=false` environment variable will need to be set when using ESLint >= 9.0. For more information, see [#&#8203;436]. [ESLint 9.0]: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes [#&#8203;381]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/381 [#&#8203;385]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/385 [#&#8203;394]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/394 [#&#8203;420]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/420 [#&#8203;421]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/421 [#&#8203;423]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/423 [#&#8203;424]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/424 [#&#8203;427]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/427 [#&#8203;430]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/430 [#&#8203;431]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/431 [#&#8203;436]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/436 [#&#8203;453]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/453 [#&#8203;458]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/458 ### [`v3.9.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#391---2024-03-31) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.0...3.9.1) ##### Added - Documentation for the following sniffs: - Generic.PHP.RequireStrictTypes - Squiz.WhiteSpace.MemberVarSpacing - Squiz.WhiteSpace.ScopeClosingBrace - Squiz.WhiteSpace.SuperfluousWhitespace - Thanks to \[Jay McPartland]\[[@&#8203;jaymcp](https://github.com/jaymcp)] and \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patches. ##### Changed - The following sniffs have received performance related improvements: - Generic.CodeAnalysis.UselessOverridingMethod - Generic.Files.ByteOrderMark - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patches. - Performance improvement for the "Diff" report. Should be most notable for Windows users. [#&#8203;355] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - The test suite has received some performance improvements. Should be most notable contributors using Windows. [#&#8203;351] - External standards with sniff tests using the PHP_CodeSniffer native test framework will also benefit from these changes. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch. - Various housekeeping, including improvements to the tests and documentation. - Thanks to \[Jay McPartland]\[[@&#8203;jaymcp](https://github.com/jaymcp)], \[João Pedro Oliveira]\[[@&#8203;jpoliveira08](https://github.com/jpoliveira08)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions. ##### Fixed - Fixed bug [#&#8203;289] : Squiz.WhiteSpace.OperatorSpacing and PSR12.Operators.OperatorSpacing : improved fixer conflict protection by more strenuously avoiding handling operators in declare statements. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch. - Fixed bug [#&#8203;366] : Generic.CodeAnalysis.UselessOverridingMethod : prevent false negative when the declared method name and the called method name do not use the same case. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch. - Fixed bug [#&#8203;368] : Squiz.Arrays.ArrayDeclaration fixer did not handle static closures correctly when moving array items to their own line. - Thanks to \[Michał Bundyra]\[[@&#8203;michalbundyra](https://github.com/michalbundyra)] for the patch. - Fixed bug [#&#8203;404] : Test framework : fixed PHP 8.4 deprecation notice. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [#&#8203;289]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/289 [#&#8203;351]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/351 [#&#8203;355]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/355 [#&#8203;366]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/366 [#&#8203;368]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/368 [#&#8203;404]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/404 ### [`v3.9.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#390---2024-02-16) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.1...3.9.0) ##### Added - Tokenizer support for PHP 8.3 typed class constants. [#&#8203;321] - Additionally, the following sniffs have been updated to support typed class constants: - Generic.NamingConventions.UpperCaseConstantName [#&#8203;332] - Generic.PHP.LowerCaseConstant [#&#8203;330] - Generic.PHP.LowerCaseType [#&#8203;331] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - Tokenizer support for PHP 8.3 readonly anonymous classes. [#&#8203;309] - Additionally, the following sniffs have been updated to support readonly anonymous classes: - PSR12.Classes.ClassInstantiation [#&#8203;324] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - New `PHP_CodeSniffer\Sniffs\DeprecatedSniff` interface to allow for marking a sniff as deprecated. [#&#8203;281] - If a ruleset uses deprecated sniffs, deprecation notices will be shown to the end-user before the scan starts. When running in `-q` (quiet) mode, the deprecation notices will be hidden. - Deprecated sniffs will still run and using them will have no impact on the exit code for a scan. - In ruleset "explain"-mode (`-e`) an asterix `*` will show next to deprecated sniffs. - Sniff maintainers are advised to read through the PR description for full details on how to use this feature for their own (deprecated) sniffs. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - New `Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence` sniff. [#&#8203;197] - Forbid mixing different binary boolean operators within a single expression without making precedence clear using parentheses - Thanks to \[Tim Düsterhus]\[[@&#8203;TimWolla](https://github.com/TimWolla)] for the contribution - Squiz.PHP.EmbeddedPhp : the sniff will now also examine the formatting of embedded PHP statements using short open echo tags. [#&#8203;27] - Includes a new `ShortOpenEchoNoSemicolon` errorcode to allow for selectively ignoring missing semicolons in single line embedded PHP snippets within short open echo tags. - The other error codes are the same and do not distinguish between what type of open tag was used. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Documentation for the following sniffs: - Generic.WhiteSpace.IncrementDecrementSpacing - PSR12.ControlStructures.ControlStructureSpacing - PSR12.Files.ImportStatement - PSR12.Functions.ReturnTypeDeclaration - PSR12.Properties.ConstantVisibility - Thanks to \[Denis Žoljom]\[[@&#8203;dingo-d](https://github.com/dingo-d)] and \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patches ##### Changed - The Performance report can now also be used for a `phpcbf` run. [#&#8203;308] - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Sniff tests which extend the PHPCS native `AbstractSniffUnitTest` class will now show a (non-build-breaking) warning when test case files contain fixable errors/warnings, but there is no corresponding `.fixed` file available in the test suite to verify the fixes against. [#&#8203;336] - The warning is only displayed on PHPUnit 7.3.0 and higher. - The warning will be elevated to a test failure in PHPCS 4.0. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - The following sniffs have received performance related improvements: - Squiz.PHP.EmbeddedPhp - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Various housekeeping, including improvements to the tests and documentation - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)], \[Joachim Noreiko]\[[@&#8203;joachim-n](https://github.com/joachim-n)], \[Remi Collet]\[[@&#8203;remicollet](https://github.com/remicollet)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions ##### Deprecated - Support for scanning JavaScript and CSS files. See [#&#8203;2448][sq-2448]. - This also means that all sniffs which are only aimed at JavaScript or CSS files are now deprecated. - The Javascript and CSS Tokenizers, all Javascript and CSS specific sniffs, and support for JS and CSS in select sniffs which support multiple file types, will be removed in version 4.0.0. - The abstract `PHP_CodeSniffer\Filters\ExactMatch::getBlacklist()` and `PHP_CodeSniffer\Filters\ExactMatch::getWhitelist()` methods are deprecated and will be removed in the 4.0 release. See [#&#8203;198]. - In version 4.0, these methods will be replaced with abstract `ExactMatch::getDisallowedFiles()` and `ExactMatch::getAllowedFiles()` methods - To make Filters extending `ExactMatch` cross-version compatible with both PHP_CodeSniffer 3.9.0+ as well as 4.0+, implement the new `getDisallowedFiles()` and `getAllowedFiles()` methods. - When both the `getDisallowedFiles()` and `getAllowedFiles()` methods as well as the `getBlacklist()` and `getWhitelist()` are available, the new methods will take precedence over the old methods. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The MySource standard and all sniffs in it. See [#&#8203;2471][sq-2471]. - The MySource standard and all sniffs in it will be removed in version 4.0.0. - The `Zend.Debug.CodeAnalyzer` sniff. See [#&#8203;277]. - This sniff will be removed in version 4.0.0. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Fixed - Fixed bug [#&#8203;127] : Squiz.Commenting.FunctionComment : The `MissingParamType` error code will now be used instead of `MissingParamName` when a parameter name is provided, but not its type. Additionally, invalid type hint suggestions will no longer be provided in these cases. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;196] : Squiz.PHP.EmbeddedPhp : fixer will no longer leave behind trailing whitespace when moving code to another line. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;196] : Squiz.PHP.EmbeddedPhp : will now determine the needed indent with higher precision in multiple situations. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;196] : Squiz.PHP.EmbeddedPhp : fixer will no longer insert a stray new line when the closer of a multi-line embedded PHP block and the opener of the next multi-line embedded PHP block would be on the same line. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;235] : Generic.CodeAnalysis.ForLoopWithTestFunctionCall : prevent a potential PHP 8.3 deprecation notice during live coding - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch - Fixed bug [#&#8203;288] : Generic.WhiteSpace.IncrementDecrementSpacing : error message for post-in/decrement will now correctly inform about new lines found before the operator. - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch - Fixed bug [#&#8203;296] : Generic.WhiteSpace.ArbitraryParenthesesSpacing : false positive for non-arbitrary parentheses when these follow the scope closer of a `switch` `case`. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;307] : PSR2.Classes.ClassDeclaration : space between a modifier keyword and the `class` keyword was not checked when the space included a new line or comment. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;325] : Squiz.Operators.IncrementDecrementUsage : the sniff was underreporting when there was (no) whitespace and/or comments in unexpected places. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;335] : PSR12.Files.DeclareStatement : bow out in a certain parse error situation to prevent incorrect auto-fixes from being made. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;340] : Squiz.Commenting.ClosingDeclarationComment : no longer adds a stray newline when adding a missing comment. - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch ##### Other - A "Community cc list" has been introduced to ping maintainers of external standards and integrators for input regarding change proposals for PHP_CodeSniffer which may impact them. [#&#8203;227] - For anyone who missed the discussion about this and is interested to be on this list, please feel invited to submit a PR to add yourself. The list is located in the `.github` folder. [sq-2448]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2448 [sq-2471]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2471 [#&#8203;27]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/27 [#&#8203;127]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/127 [#&#8203;196]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/196 [#&#8203;197]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/197 [#&#8203;198]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/198 [#&#8203;227]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/227 [#&#8203;235]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/235 [#&#8203;277]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/277 [#&#8203;281]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/281 [#&#8203;288]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/288 [#&#8203;296]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/296 [#&#8203;307]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/307 [#&#8203;308]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/308 [#&#8203;309]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/309 [#&#8203;321]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/321 [#&#8203;324]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/324 [#&#8203;325]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/325 [#&#8203;330]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/330 [#&#8203;331]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/331 [#&#8203;332]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/332 [#&#8203;335]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/335 [#&#8203;336]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/336 [#&#8203;340]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/340 ### [`v3.8.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#381---2024-01-11) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.0...3.8.1) ##### Added - Documentation has been added for the following sniffs: - Generic.CodeAnalysis.EmptyPHPStatement - Generic.Formatting.SpaceBeforeCast - Generic.PHP.Syntax - Generic.WhiteSpace.LanguageConstructSpacing - PSR12.Classes.ClosingBrace - PSR12.Classes.OpeningBraceSpace - PSR12.ControlStructures.BooleanOperatorPlacement - PSR12.Files.OpenTag - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Denis Žoljom]\[[@&#8203;dingo-d](https://github.com/dingo-d)] for the patches ##### Changed - GitHub releases will now always only contain unversioned release assets (PHARS + asc files) (same as it previously was in the squizlabs repo). See [#&#8203;205] for context. - Thanks to \[Shivam Mathur]\[[@&#8203;shivammathur](https://github.com/shivammathur)] for opening a discussion about this - Various housekeeping, includes improvements to the tests and documentation - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)], \[Lucas Hoffmann]\[[@&#8203;lucc](https://github.com/lucc)], \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for their contributions ##### Fixed - Fixed bug [#&#8203;124] : Report Full : avoid unnecessarily wrapping lines when `-s` is used - Thanks to \[Brad Jorsch]\[[@&#8203;anomiex](https://github.com/anomiex)] for the patch - Fixed bug [#&#8203;124] : Report Full : fix incorrect bolding of pipes when `-s` is used and messages wraps - Thanks to \[Brad Jorsch]\[[@&#8203;anomiex](https://github.com/anomiex)] for the patch - Fixed bug [#&#8203;150] : Squiz.WhiteSpace.KeywordSpacing : prevent a PHP notice when run during live coding - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;154] : Report Full : delimiter line calculation could go wonky on wide screens when a report contains multi-line messages - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;178] : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP native union/intersection type declarations - Thanks to \[Ferdinand Kuhl]\[[@&#8203;fcool](https://github.com/fcool)] for the patch - Fixed bug [#&#8203;211] : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP 8.2+ stand-alone `true`/`false`/`null` type declarations - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;211] : Squiz.Commenting.VariableComment : docblocks were incorrectly being flagged as missing when a property declaration used PHP native `parent`, `self` or a namespace relative class name type declaration - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;226] : Generic.CodeAnalysis.ForLoopShouldBeWhileLoop : prevent a potential PHP 8.3 deprecation notice during live coding - Thanks to \[Rodrigo Primo]\[[@&#8203;rodrigoprimo](https://github.com/rodrigoprimo)] for the patch [#&#8203;124]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/124 [#&#8203;150]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/150 [#&#8203;154]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/154 [#&#8203;178]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/178 [#&#8203;205]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/205 [#&#8203;211]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/211 [#&#8203;226]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/226 ### [`v3.8.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#380---2023-12-08) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.7.2...3.8.0) [Squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is dead. Long live [PHPCSStandards/PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer)! ##### Breaking Changes - The `squizlabs/PHP_CodeSniffer` repository has been abandoned. The `PHPCSStandards/PHP_CodeSniffer` repository will serve as the continuation of the project. For more information about this change, please read the [announcement](https://github.com/squizlabs/PHP_CodeSniffer/issues/3932). - Installation of PHP_CodeSniffer via PEAR is no longer supported. - Users will need to switch to another installation method. - Note: this does not affect the PEAR sniffs. - For Composer users, nothing changes. - ***In contrast to earlier information, the `squizlabs/php_codesniffer` package now points to the new repository and everything will continue to work as before.*** - PHIVE users may need to clear the PHIVE URL cache. - PHIVE users who don't use the package alias, but refer to the package URL, will need to update the URL from `https://squizlabs.github.io/PHP_CodeSniffer/phars/` to `https://phars.phpcodesniffer.com/phars/`. - Users who download the PHAR files using curl or wget, will need to update the download URL from `https://squizlabs.github.io/PHP_CodeSniffer/[phpcs|phpcbf].phar` or `https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/[phpcs|phpcbf].phar` to `https://phars.phpcodesniffer.com/[phpcs|phpcbf].phar`. - For users who install PHP_CodeSniffer via the [Setup-PHP](https://github.com/shivammathur/setup-php/) action runner for GitHub Actions, nothing changes. - Users using a git clone will need to update the clone address from `git@github.com:squizlabs/PHP_CodeSniffer.git` to `git@github.com:PHPCSStandards/PHP_CodeSniffer.git`. - Contributors will need to fork the new repo and add both the new fork as well as the new repo as remotes to their local git copy of PHP_CodeSniffer. - Users who have (valid) open issues or pull requests in the `squizlabs/PHP_CodeSniffer` repository are invited to resubmit these to the `PHPCSStandards/PHP_CodeSniffer` repository. ##### Added - Runtime support for PHP 8.3. All known PHP 8.3 deprecation notices have been fixed - Syntax support for new PHP 8.3 features will follow in a future release - If you find any PHP 8.3 deprecation notices which were missed, please report them - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - Added support for PHP 8.2 readonly classes to File::getClassProperties() through a new is_readonly array index in the return value - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.2 readonly classes to a number of sniffs - Generic.CodeAnalysis.UnnecessaryFinalModifier - PEAR.Commenting.ClassComment - PEAR.Commenting.FileComment - PSR1.Files.SideEffects - PSR2.Classes.ClassDeclaration - PSR12.Files.FileHeader - Squiz.Classes.ClassDeclaration - Squiz.Classes.LowercaseClassKeywords - Squiz.Commenting.ClassComment - Squiz.Commenting.DocCommentAlignment - Squiz.Commenting.FileComment - Squiz.Commenting.InlineComment - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.2 `true` as a stand-alone type declaration - The `File::getMethodProperties()`, `File::getMethodParameters()` and `File::getMemberProperties()` methods now all support the `true` type - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.2 `true` as a stand-alone type to a number of sniffs - Generic.PHP.LowerCaseType - PSr12.Functions.NullableTypeDeclaration - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added a Performance report to allow for finding "slow" sniffs - To run this report, run PHPCS with --report=Performance. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.PHP.RequireStrictTypes : new warning for when there is a declare statement, but the strict_types directive is set to 0 - The warning can be turned off by excluding the `Generic.PHP.RequireStrictTypes.Disabled` error code - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Squiz.Commenting.FunctionComment : new `ParamNameUnexpectedAmpersandPrefix` error for parameters annotated as passed by reference while the parameter is not passed by reference - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Documentation has been added for the following sniffs: - PSR2.Files.ClosingTag - PSR2.Methods.FunctionCallSignature - PSR2.Methods.FunctionClosingBrace - Thanks to \[Atsushi Okui]\[[@&#8203;blue32a](https://github.com/blue32a)] for the patch - Support for PHPUnit 8 and 9 to the test suite - Test suites for external standards which run via the PHPCS native test suite can now run on PHPUnit 4-9 (was 4-7) - If any of these tests use the PHPUnit `setUp()`/`tearDown()` methods or overload the `setUp()` in the `AbstractSniffUnitTest` test case, they will need to be adjusted. See the [PR details for further information](https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/59/commits/bc302dd977877a22c5e60d42a2f6b7d9e9192dab) - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Changed - Changes have been made to the way PHPCS handles invalid sniff properties being set in a custom ruleset - Fixes PHP 8.2 deprecation notices for properties set in a (custom) ruleset for complete standards/complete sniff categories - Invalid sniff properties set for individual sniffs will now result in an error and halt the execution of PHPCS - A descriptive error message is provided to allow users to fix their ruleset - Sniff properties set for complete standards/complete sniff categories will now only be set on sniffs which explicitly support the property - The property will be silently ignored for those sniffs which do not support the property - Invalid sniff properties set for sniffs via inline annotations will result in an informative `Internal.PropertyDoesNotExist` errror on line 1 of the scanned file, but will not halt the execution of PHPCS - For sniff developers, it is strongly recommended for sniffs to explicitly declare any user-adjustable public properties - If dynamic properties need to be supported for a sniff, either declare the magic \__set()/\__get()/\__isset()/\__unset() methods on the sniff or let the sniff extend stdClass - Note: The `#[\AllowDynamicProperties]` attribute will have no effect for properties which are being set in rulesets - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The third parameter for the Ruleset::setSniffProperty() method has been changed to expect an array - Sniff developers/integrators of PHPCS may need to make some small adjustments to allow for this change - Existing code will continue to work but will throw a deprecation error - The backwards compatiblity layer will be removed in PHPCS 4.0 - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - When using `auto` report width (the default) a value of 80 columns will be used if the width cannot be determined - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Sniff error messages are now more informative to help bugs get reported to the correct project - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.CodeAnalysis.UnusedFunctionParameter will now ignore magic methods for which the signature is defined by PHP - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.Functions.OpeningFunctionBraceBsdAllman will now check the brace indent before the opening brace for empty functions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.Functions.OpeningFunctionBraceKernighanRitchie will now check the spacing before the opening brace for empty functions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.WhiteSpace.IncrementDecrementSpacing now detects more spacing issues - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - PSR2.Classes.PropertyDeclaration now enforces that the readonly modifier comes after the visibility modifier - PSR2 and PSR12 do not have documented rules for this as they pre-date the readonly modifier - PSR-PER has been used to confirm the order of this keyword so it can be applied to PSR2 and PSR12 correctly - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - PEAR.Commenting.FunctionComment + Squiz.Commenting.FunctionComment: the SpacingAfter error can now be auto-fixed - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Squiz.PHP.InnerFunctions sniff no longer reports on OO methods for OO structures declared within a function or closure - Thanks to \[[@&#8203;Daimona](https://github.com/Daimona)] for the patch - Squiz.PHP.NonExecutableCode will now also flag redundant return statements just before a closure close brace - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Runtime performance improvement for PHPCS CLI users. The improvement should be most noticeable for users on Windows. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The following sniffs have received performance related improvements: - Generic.PHP.LowerCaseConstant - Generic.PHP.LowerCaseType - PSR12.Files.OpenTag - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - The -e (explain) command will now list sniffs in natural order - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Tests using the PHPCS native test framework with multiple test case files will now run the test case files in numeric order. - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The following sniffs have received minor message readability improvements: - Generic.Arrays.ArrayIndent - Generic.Formatting.SpaceAfterCast - Generic.Formatting.SpaceAfterNot - Generic.WhiteSpace.SpreadOperatorSpacingAfter - Squiz.Arrays.ArrayDeclaration - Squiz.Commenting.DocCommentAlignment - Squiz.ControlStructures.ControlSignature - Thanks to \[Danny van der Sluijs]\[[@&#8203;DannyvdSluijs](https://github.com/DannyvdSluijs)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - Improved README syntax highlighting - Thanks to \[Benjamin Loison]\[[@&#8203;Benjamin-Loison](https://github.com/Benjamin-Loison)] for the patch - Various documentation improvements - Thanks to \[Andrew Dawes]\[[@&#8203;AndrewDawes](https://github.com/AndrewDawes)], \[Danny van der Sluijs]\[[@&#8203;DannyvdSluijs](https://github.com/DannyvdSluijs)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches ##### Removed - Removed support for installation via PEAR - Use composer or the PHAR files instead ##### Fixed - Fixed bug [#&#8203;2857][sq-2857] : Squiz/NonExecutableCode: prevent false positives when exit is used in a ternary expression or as default with null coalesce - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3386][sq-3386] : PSR1/SideEffects : improved recognition of disable/enable annotations - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3557][sq-3557] : Squiz.Arrays.ArrayDeclaration will now ignore PHP 7.4 array unpacking when determining whether an array is associative - Thanks to \[Volker Dusch]\[[@&#8203;edorian](https://github.com/edorian)] for the patch - Fixed bug [#&#8203;3592][sq-3592] : Squiz/NonExecutableCode: prevent false positives when a PHP 8.0+ inline throw expression is encountered - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3715][sq-3715] : Generic/UnusedFunctionParameter: fixed incorrect errorcode for closures/arrow functions nested within extended classes/classes which implement - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3717][sq-3717] : Squiz.Commenting.FunctionComment: fixed false positive for `InvalidNoReturn` when type is never - Thanks to \[Choraimy Kroonstuiver]\[[@&#8203;axlon](https://github.com/axlon)] for the patch - Fixed bug [#&#8203;3720][sq-3720] : Generic/RequireStrictTypes : will now bow out silently in case of parse errors/live coding instead of throwing false positives/false negatives - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3720][sq-3720] : Generic/RequireStrictTypes : did not handle multi-directive declare statements - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3722][sq-3722] : Potential "Uninitialized string offset 1" in octal notation backfill - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3736][sq-3736] : PEAR/FunctionDeclaration: prevent fixer removing the close brace (and creating a parse error) when there is no space between the open brace and close brace of a function - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3739][sq-3739] : PEAR/FunctionDeclaration: prevent fixer conflict, and potentially creating a parse error, for unconventionally formatted return types - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3770][sq-3770] : Squiz/NonExecutableCode: prevent false positives for switching between PHP and HTML - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;3773][sq-3773] : Tokenizer/PHP: tokenization of the readonly keyword when used in combination with PHP 8.2 disjunctive normal types - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] and \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3776][sq-3776] : Generic/JSHint: error when JSHint is not available - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;3777][sq-3777] : Squiz/NonExecutableCode: slew of bug fixes, mostly related to modern PHP - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3778][sq-3778] : Squiz/LowercasePHPFunctions: bug fix for class names in attributes - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3779][sq-3779] : Generic/ForbiddenFunctions: bug fix for class names in attributes - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3785][sq-3785] : Squiz.Commenting.FunctionComment: potential "Uninitialized string offset 0" when a type contains a duplicate pipe symbol - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;3787][sq-3787] : `PEAR/Squiz/[MultiLine]FunctionDeclaration`: allow for PHP 8.1 new in initializers - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3789][sq-3789] : Incorrect tokenization for ternary operator with `match` inside of it - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3790][sq-3790] : PSR12/AnonClassDeclaration: prevent fixer creating parse error when there was no space before the open brace - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3797][sq-3797] : Tokenizer/PHP: more context sensitive keyword fixes - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3801][sq-3801] : File::getMethodParameters(): allow for readonly promoted properties without visibility - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3805][sq-3805] : Generic/FunctionCallArgumentSpacing: prevent fixer conflict over PHP 7.3+ trailing comma's in function calls - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3806][sq-3806] : Squiz.PHP.InnerFunctions sniff now correctly reports inner functions declared within a closure - Thanks to \[[@&#8203;Daimona](https://github.com/Daimona)] for the patch - Fixed bug [#&#8203;3809][sq-3809] : GitBlame report was broken when passing a basepath - Thanks to \[Chris]\[[@&#8203;datengraben](https://github.com/datengraben)] for the patch - Fixed bug [#&#8203;3813][sq-3813] : Squiz.Commenting.FunctionComment: false positive for parameter name mismatch on parameters annotated as passed by reference - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;3833][sq-3833] : Generic.PHP.LowerCaseType: fixed potential undefined array index notice - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3846][sq-3846] : PSR2.Classes.ClassDeclaration.CloseBraceAfterBody : fixer will no longer remove indentation on the close brace line - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3854][sq-3854] : Fatal error when using Gitblame report in combination with `--basepath` and running from project subdirectory - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3856][sq-3856] : PSR12.Traits.UseDeclaration was using the wrong error code - SpacingAfterAs - for spacing issues after the `use` keyword - These will now be reported using the SpacingAfterUse error code - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3856][sq-3856] : PSR12.Traits.UseDeclaration did not check spacing after `use` keyword for multi-line trait use statements - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3867][sq-3867] : Tokenizer/PHP: union type and intersection type operators were not correctly tokenized for static properties without explicit visibility - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3877][sq-3877] : Filter names can be case-sensitive. The -h help text will now display the correct case for the available filters - Thanks to \[[@&#8203;simonsan](https://github.com/simonsan)] for the patch - Fixed bug [#&#8203;3893][sq-3893] : Generic/DocComment : the SpacingAfterTagGroup fixer could accidentally remove ignore annotations - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3898][sq-3898] : Squiz/NonExecutableCode : the sniff could get confused over comments in unexpected places - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3904][sq-3904] : Squiz/FunctionSpacing : prevent potential fixer conflict - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3906][sq-3906] : Tokenizer/CSS: bug fix related to the unsupported slash comment syntax - Thanks to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] for the patch - Fixed bug [#&#8203;3913][sq-3913] : Config did not always correctly store unknown "long" arguments in the `$unknown` property - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch Thanks go to \[Dan Wallis]\[[@&#8203;fredden](https://github.com/fredden)] and \[Danny van der Sluijs]\[[@&#8203;DannyvdSluijs](https://github.com/DannyvdSluijs)] for reviewing quite a few of the PRs for this release. Additionally, thanks to \[Alexander Turek]\[[@&#8203;derrabus](https://github.com/derrabus)] for consulting on the repo change over. [sq-2857]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2857 [sq-3386]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3386 [sq-3557]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3557 [sq-3592]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3592 [sq-3715]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3715 [sq-3717]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3717 [sq-3720]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3720 [sq-3722]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3722 [sq-3736]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3736 [sq-3739]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3739 [sq-3770]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3770 [sq-3773]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3773 [sq-3776]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3776 [sq-3777]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3777 [sq-3778]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3778 [sq-3779]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3779 [sq-3785]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3785 [sq-3787]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3787 [sq-3789]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3789 [sq-3790]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3790 [sq-3797]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3797 [sq-3801]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3801 [sq-3805]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3805 [sq-3806]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3806 [sq-3809]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3809 [sq-3813]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3813 [sq-3833]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3833 [sq-3846]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3846 [sq-3854]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3854 [sq-3856]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3856 [sq-3867]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3867 [sq-3877]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3877 [sq-3893]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3893 [sq-3898]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3898 [sq-3904]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3904 [sq-3906]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3906 [sq-3913]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3913 ### [`v3.7.2`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#372---2023-02-23) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.7.1...3.7.2) ##### Changed - Newer versions of Composer will now suggest installing PHPCS using require-dev instead of require - Thanks to \[Gary Jones]\[[@&#8203;GaryJones](https://github.com/GaryJones)] for the patch - A custom Out Of Memory error will now be shown if PHPCS or PHPCBF run out of memory during a run - Error message provides actionable information about how to fix the problem and ensures the error is not silent - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] and \[Alain Schlesser]\[[@&#8203;schlessera](https://github.com/schlessera)] for the patch - Generic.PHP.LowerCaseType sniff now correctly examines types inside arrow functions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Squiz.Formatting.OperatorBracket no longer reports false positives in match() structures ##### Fixed - Fixed bug [#&#8203;3616][sq-3616] : Squiz.PHP.DisallowComparisonAssignment false positive for PHP 8 match expression - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3618][sq-3618] : Generic.WhiteSpace.ArbitraryParenthesesSpacing false positive for return new parent() - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3632][sq-3632] : Short list not tokenized correctly in control structures without braces - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3639][sq-3639] : Tokenizer not applying tab replacement to heredoc/nowdoc closers - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3640][sq-3640] : Generic.WhiteSpace.DisallowTabIndent not reporting errors for PHP 7.3 flexible heredoc/nowdoc syntax - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3645][sq-3645] : PHPCS can show 0 exit code when running in parallel even if child process has fatal error - Thanks to \[Alex Panshin]\[[@&#8203;enl](https://github.com/enl)] for the patch - Fixed bug [#&#8203;3653][sq-3653] : False positives for match() in OperatorSpacingSniff - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch - Fixed bug [#&#8203;3666][sq-3666] : PEAR.Functions.FunctionCallSignature incorrect indent fix when checking mixed HTML/PHP files - Fixed bug [#&#8203;3668][sq-3668] : PSR12.Classes.ClassInstantiation.MissingParentheses false positive when instantiating parent classes - Similar issues also fixed in Generic.Functions.FunctionCallArgumentSpacing and Squiz.Formatting.OperatorBracket - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3672][sq-3672] : Incorrect ScopeIndent.IncorrectExact report for match inside array literal - Fixed bug [#&#8203;3694][sq-3694] : Generic.WhiteSpace.SpreadOperatorSpacingAfter does not ignore spread operator in PHP 8.1 first class callables - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-3616]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3616 [sq-3618]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3618 [sq-3632]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3632 [sq-3639]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3639 [sq-3640]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3640 [sq-3645]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3645 [sq-3653]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3653 [sq-3666]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3666 [sq-3668]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3668 [sq-3672]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3672 [sq-3694]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3694 ### [`v3.7.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#371---2022-06-18) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.7.0...3.7.1) ##### Fixed - Fixed bug [#&#8203;3609][sq-3609] : Methods/constants with name empty/isset/unset are always reported as error - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-3609]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3609 ### [`v3.7.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#370---2022-06-13) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.6.2...3.7.0) ##### Added - Added support for PHP 8.1 explicit octal notation - This new syntax has been backfilled for PHP versions less than 8.1 - Thanks to \[Mark Baker]\[[@&#8203;MarkBaker](https://github.com/MarkBaker)] for the patch - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for additional fixes - Added support for PHP 8.1 enums - This new syntax has been backfilled for PHP versions less than 8.1 - Includes a new T_ENUM_CASE token to represent the case statements inside an enum - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for additional core and sniff support - Added support for the PHP 8.1 readonly token - Tokenizing of the readonly keyword has been backfilled for PHP versions less than 8.1 - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch - Added support for PHP 8.1 intersection types - Includes a new T_TYPE_INTERSECTION token to represent the ampersand character inside intersection types - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch ##### Changed - File::getMethodParameters now supports the new PHP 8.1 readonly token - When constructor property promotion is used, a new property_readonly array index is included in the return value - This is a boolean value indicating if the property is readonly - If the readonly token is detected, a new readonly_token array index is included in the return value - This contains the token index of the readonly keyword - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Support for new PHP 8.1 readonly keyword has been added to the following sniffs: - Generic.PHP.LowerCaseKeyword - PSR2.Classes.PropertyDeclaration - Squiz.Commenting.BlockComment - Squiz.Commenting.DocCommentAlignment - Squiz.Commenting.VariableComment - Squiz.WhiteSpace.ScopeKeywordSpacing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patches - The parallel feature is now more efficient and runs faster in some situations due to improved process management - Thanks to \[Sergei Morozov]\[[@&#8203;morozov](https://github.com/morozov)] for the patch - The list of installed coding standards now has consistent ordering across all platforms - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.PHP.UpperCaseConstant and Generic.PHP.LowerCaseConstant now ignore type declarations - These sniffs now only report errors for true/false/null when used as values - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.PHP.LowerCaseType now supports the PHP 8.1 never type - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch ##### Fixed - Fixed bug [#&#8203;3502][sq-3502] : A match statement within an array produces Squiz.Arrays.ArrayDeclaration.NoKeySpecified - Fixed bug [#&#8203;3503][sq-3503] : Squiz.Commenting.FunctionComment.ThrowsNoFullStop false positive when one line [@&#8203;throw](https://github.com/throw) - Fixed bug [#&#8203;3505][sq-3505] : The nullsafe operator is not counted in Generic.Metrics.CyclomaticComplexity - Thanks to \[Mark Baker]\[[@&#8203;MarkBaker](https://github.com/MarkBaker)] for the patch - Fixed bug [#&#8203;3526][sq-3526] : PSR12.Properties.ConstantVisibility false positive when using public final const syntax - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3530][sq-3530] : Line indented incorrectly false positive when using match-expression inside switch case - Fixed bug [#&#8203;3534][sq-3534] : Name of typed enum tokenized as T_GOTO_LABEL - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3546][sq-3546] : Tokenizer/PHP: bug fix - parent/static keywords in class instantiations - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3550][sq-3550] : False positive from PSR2.ControlStructures.SwitchDeclaration.TerminatingComment when using trailing comment - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3575][sq-3575] : Squiz.Scope.MethodScope misses visibility keyword on previous line - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3604][sq-3604] : Tokenizer/PHP: bug fix for double quoted strings using ${ - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-3502]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3502 [sq-3503]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3503 [sq-3505]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3505 [sq-3526]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3526 [sq-3530]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3530 [sq-3534]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3534 [sq-3546]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3546 [sq-3550]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3550 [sq-3575]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3575 [sq-3604]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3604 ### [`v3.6.2`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#362---2021-12-13) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.6.1...3.6.2) ##### Changed - Processing large code bases that use tab indenting inside comments and strings will now be faster - Thanks to \[Thiemo Kreuz]\[[@&#8203;thiemowmde](https://github.com/thiemowmde)] for the patch ##### Fixed - Fixed bug [#&#8203;3388][sq-3388] : phpcs does not work when run from WSL drives - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] and \[Graham Wharton]\[[@&#8203;gwharton](https://github.com/gwharton)] for the patch - Fixed bug [#&#8203;3422][sq-3422] : Squiz.WhiteSpace.ScopeClosingBrace fixer removes HTML content when fixing closing brace alignment - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3437][sq-3437] : PSR12 does not forbid blank lines at the start of the class body - Added new PSR12.Classes.OpeningBraceSpace sniff to enforce this - Fixed bug [#&#8203;3440][sq-3440] : Squiz.WhiteSpace.MemberVarSpacing false positives when attributes used without docblock - Thanks to \[Vadim Borodavko]\[[@&#8203;javer](https://github.com/javer)] for the patch - Fixed bug [#&#8203;3448][sq-3448] : PHP 8.1 deprecation notice while generating running time value - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] and \[Andy Postnikov]\[[@&#8203;andypost](https://github.com/andypost)] for the patch - Fixed bug [#&#8203;3456][sq-3456] : PSR12.Classes.ClassInstantiation.MissingParentheses false positive using attributes on anonymous class - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3460][sq-3460] : Generic.Formatting.MultipleStatementAlignment false positive on closure with parameters - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3468][sq-3468] : do/while loops are double-counted in Generic.Metrics.CyclomaticComplexity - Thanks to \[Mark Baker]\[[@&#8203;MarkBaker](https://github.com/MarkBaker)] for the patch - Fixed bug [#&#8203;3469][sq-3469] : Ternary Operator and Null Coalescing Operator are not counted in Generic.Metrics.CyclomaticComplexity - Thanks to \[Mark Baker]\[[@&#8203;MarkBaker](https://github.com/MarkBaker)] for the patch - Fixed bug [#&#8203;3472][sq-3472] : PHP 8 match() expression is not counted in Generic.Metrics.CyclomaticComplexity - Thanks to \[Mark Baker]\[[@&#8203;MarkBaker](https://github.com/MarkBaker)] for the patch [sq-3388]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3388 [sq-3422]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3422 [sq-3437]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3437 [sq-3440]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3440 [sq-3448]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3448 [sq-3456]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3456 [sq-3460]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3460 [sq-3468]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3468 [sq-3469]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3469 [sq-3472]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3472 ### [`v3.6.1`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#361---2021-10-11) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.6.0...3.6.1) ##### Changed - PHPCS annotations can now be specified using hash-style comments - Previously, only slash-style and block-style comments could be used to do things like disable errors - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The new PHP 8.1 tokenization for ampersands has been reverted to use the existing PHP_CodeSniffer method - The PHP 8.1 tokens T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG and T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG are unused - Ampersands continue to be tokenized as T_BITWISE_AND for all PHP versions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] and \[Anna Filina]\[[@&#8203;afilina](https://github.com/afilina)] for the patch - File::getMethodParameters() no longer incorrectly returns argument attributes in the type hint array index - A new has_attributes array index is available and set to TRUE if the argument has attributes defined - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed an issue where some sniffs would not run on PHP files that only used the short echo tag - The following sniffs were affected: - Generic.Files.ExecutableFile - Generic.Files.LowercasedFilename - Generic.Files.LineEndings - Generic.Files.EndFileNewline - Generic.Files.EndFileNoNewline - Generic.PHP.ClosingPHPTag - Generic.PHP.Syntax - Generic.VersionControl.GitMergeConflict - Generic.WhiteSpace.DisallowSpaceIndent - Generic.WhiteSpace.DisallowTabIndent - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Squiz.Commenting.BlockComment now correctly applies rules for block comments after a short echo tag - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Fixed - Generic.NamingConventions.ConstructorName no longer throws deprecation notices on PHP 8.1 - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed false positives when using attributes in the following sniffs: - PEAR.Commenting.FunctionComment - Squiz.Commenting.InlineComment - Squiz.Commenting.BlockComment - Squiz.Commenting.VariableComment - Squiz.WhiteSpace.MemberVarSpacing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3294][sq-3294] : Bug in attribute tokenization when content contains PHP end token or attribute closer on new line - Thanks to \[Alessandro Chitolina]\[[@&#8203;alekitto](https://github.com/alekitto)] for the patch - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the tests - Fixed bug [#&#8203;3296][sq-3296] : PSR2.ControlStructures.SwitchDeclaration takes phpcs:ignore as content of case body - Fixed bug [#&#8203;3297][sq-3297] : PSR2.ControlStructures.SwitchDeclaration.TerminatingComment does not handle try/finally blocks - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3302][sq-3302] : PHP 8.0 | Tokenizer/PHP: bugfix for union types using namespace operator - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3303][sq-3303] : findStartOfStatement() doesn't work with T_OPEN_TAG_WITH_ECHO - Fixed bug [#&#8203;3316][sq-3316] : Arrow function not tokenized correctly when using null in union type - Fixed bug [#&#8203;3317][sq-3317] : Problem with how phpcs handles ignored files when running in parallel - Thanks to \[Emil Andersson]\[[@&#8203;emil-nasso](https://github.com/emil-nasso)] for the patch - Fixed bug [#&#8203;3324][sq-3324] : PHPCS hangs processing some nested arrow functions inside a function call - Fixed bug [#&#8203;3326][sq-3326] : Generic.Formatting.MultipleStatementAlignment error with const DEFAULT - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3333][sq-3333] : Squiz.Objects.ObjectInstantiation: null coalesce operators are not recognized as assignment - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3340][sq-3340] : Ensure interface and trait names are always tokenized as T_STRING - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3342][sq-3342] : PSR12/Squiz/PEAR standards all error on promoted properties with docblocks - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3345][sq-3345] : IF statement with no braces and double catch turned into syntax error by auto-fixer - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3352][sq-3352] : PSR2.ControlStructures.SwitchDeclaration can remove comments on the same line as the case statement while fixing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3357][sq-3357] : Generic.Functions.OpeningFunctionBraceBsdAllman removes return type when additional lines are present - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3362][sq-3362] : Generic.WhiteSpace.ScopeIndent false positive for arrow functions inside arrays - Fixed bug [#&#8203;3384][sq-3384] : Squiz.Commenting.FileComment.SpacingAfterComment false positive on empty file - Fixed bug [#&#8203;3394][sq-3394] : Fix PHP 8.1 auto_detect_line_endings deprecation notice - Fixed bug [#&#8203;3400][sq-3400] : PHP 8.1: prevent deprecation notices about missing return types - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3424][sq-3424] : PHPCS fails when using PHP 8 Constructor property promotion with attributes - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3425][sq-3425] : PHP 8.1 | Runner::processChildProcs(): fix passing null to non-nullable bug - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3445][sq-3445] : Nullable parameter after attribute incorrectly tokenized as ternary operator - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-3294]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3294 [sq-3296]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3296 [sq-3297]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3297 [sq-3302]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3302 [sq-3303]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3303 [sq-3316]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3316 [sq-3317]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3317 [sq-3324]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3324 [sq-3326]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3326 [sq-3333]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3333 [sq-3340]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3340 [sq-3342]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3342 [sq-3345]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3345 [sq-3352]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3352 [sq-3357]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3357 [sq-3362]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3362 [sq-3384]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3384 [sq-3394]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3394 [sq-3400]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3400 [sq-3424]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3424 [sq-3425]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3425 [sq-3445]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3445 ### [`v3.6.0`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#360---2021-04-09) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.5.8...3.6.0) ##### Added - Added support for PHP 8.0 union types - A new T_TYPE_UNION token is available to represent the pipe character - File::getMethodParameters(), getMethodProperties(), and getMemberProperties() will now return union types - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.0 named function call arguments - A new T_PARAM_NAME token is available to represent the label with the name of the function argument in it - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.0 attributes - The PHP-supplied T_ATTRIBUTE token marks the start of an attribute - A new T_ATTRIBUTE_END token is available to mark the end of an attribute - New attribute_owner and attribute_closer indexes are available in the tokens array for all tokens inside an attribute - Tokenizing of attributes has been backfilled for older PHP versions - The following sniffs have been updated to support attributes: - PEAR.Commenting.ClassComment - PEAR.Commenting.FileComment - PSR1.Files.SideEffects - PSR12.Files.FileHeader - Squiz.Commenting.ClassComment - Squiz.Commenting.FileComment - Squiz.WhiteSpace.FunctionSpacing - Thanks to \[Vadim Borodavko]\[[@&#8203;javer](https://github.com/javer)] for the patch - Thanks to \[Alessandro Chitolina]\[[@&#8203;alekitto](https://github.com/alekitto)] for the patch - Added support for PHP 8.0 dereferencing of text strings with interpolated variables - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for PHP 8.0 match expressions - Match expressions are now tokenized with parenthesis and scope openers and closers - Sniffs can listen for the T_MATCH token to process match expressions - Note that the case and default statements inside match expressions do not have scopes set - A new T_MATCH_ARROW token is available to represent the arrows in match expressions - A new T_MATCH_DEFAULT token is available to represent the default keyword in match expressions - All tokenizing of match expressions has been backfilled for older PHP versions - The following sniffs have been updated to support match expressions: - Generic.CodeAnalysis.AssignmentInCondition - Generic.CodeAnalysis.EmptyPHPStatement - Thanks to \[Vadim Borodavko]\[[@&#8203;javer](https://github.com/javer)] for the patch - Generic.CodeAnalysis.EmptyStatement - Generic.PHP.LowerCaseKeyword - PEAR.ControlStructures.ControlSignature - PSR12.ControlStructures.BooleanOperatorPlacement - Squiz.Commenting.LongConditionClosingComment - Squiz.Commenting.PostStatementComment - Squiz.ControlStructures.LowercaseDeclaration - Squiz.ControlStructures.ControlSignature - Squiz.Formatting.OperatorBracket - Squiz.PHP.DisallowMultipleAssignments - Squiz.Objects.ObjectInstantiation - Squiz.WhiteSpace.ControlStructureSpacing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added Generic.NamingConventions.AbstractClassNamePrefix to enforce that class names are prefixed with "Abstract" - Thanks to \[Anna Borzenko]\[[@&#8203;annechko](https://github.com/annechko)] for the contribution - Added Generic.NamingConventions.InterfaceNameSuffix to enforce that interface names are suffixed with "Interface" - Thanks to \[Anna Borzenko]\[[@&#8203;annechko](https://github.com/annechko)] for the contribution - Added Generic.NamingConventions.TraitNameSuffix to enforce that trait names are suffixed with "Trait" - Thanks to \[Anna Borzenko]\[[@&#8203;annechko](https://github.com/annechko)] for the contribution ##### Changed - The value of the T_FN_ARROW token has changed from "T_FN_ARROW" to "PHPCS_T_FN_ARROW" to avoid package conflicts - This will have no impact on custom sniffs unless they are specifically looking at the value of the T_FN_ARROW constant - If sniffs are just using constant to find arrow functions, they will continue to work without modification - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - File::findStartOfStatement() now works correctly when passed the last token in a statement - File::getMethodParameters() now supports PHP 8.0 constructor property promotion - Returned method params now include a "property_visibility" and "visibility_token" index if property promotion is detected - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - File::getMethodProperties() now includes a "return_type_end_token" index in the return value - This indicates the last token in the return type, which is helpful when checking union types - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Include patterns are now ignored when processing STDIN - Previously, checks using include patterns were excluded when processing STDIN when no file path was provided via --stdin-path - Now, all include and exclude rules are ignored when no file path is provided, allowing all checks to run - If you want include and exclude rules enforced when checking STDIN, use --stdin-path to set the file path - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Spaces are now correctly escaped in the paths to external on Windows - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.CodeAnalysis.UnusedFunctionParameter can now be configured to ignore variable usage for specific type hints - This allows you to suppress warnings for some variables that are not required, but leave warnings for others - Set the ignoreTypeHints array property to a list of type hints to ignore - Thanks to \[Petr Bugyík]\[[@&#8203;o5](https://github.com/o5)] for the patch - Generic.Formatting.MultipleStatementAlignment can now align statements at the start of the assignment token - Previously, the sniff enforced that the values were aligned, even if this meant the assignment tokens were not - Now, the sniff can enforce that the assignment tokens are aligned, even if this means the values are not - Set the "alignAtEnd" sniff property to "false" to align the assignment tokens - The default remains at "true", so the assigned values are aligned - Thanks to \[John P. Bloch]\[[@&#8203;johnpbloch](https://github.com/johnpbloch)] for the patch - Generic.PHP.LowerCaseType now supports checking of typed properties - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Generic.PHP.LowerCaseType now supports checking of union types - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - PEAR.Commenting.FunctionComment and Squiz.Commenting.FunctionComment sniffs can now ignore private and protected methods - Set the "minimumVisibility" sniff property to "protected" to ignore private methods - Set the "minimumVisibility" sniff property to "public" to ignore both private and protected methods - The default remains at "private", so all methods are checked - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch - PEAR.Commenting.FunctionComment and Squiz.Commenting.FunctionComment sniffs can now ignore return tags in any method - Previously, only `__construct()` and `__destruct()` were ignored - Set the list of method names to ignore in the "specialMethods" sniff property - The default remains at "\__construct" and "\__destruct" only - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch - PSR2.ControlStructures.SwitchDeclaration now supports nested switch statements where every branch terminates - Previously, if a CASE only contained a SWITCH and no direct terminating statement, a fall-through error was displayed - Now, the error is suppressed if every branch of the SWITCH has a terminating statement - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch - The PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket error message is now reported on the closing parenthesis token - Previously, the error was being reported on the function keyword, leading to confusing line numbers in the error report - Squiz.Commenting.FunctionComment is now able to ignore function comments that are only inheritdoc statements - Set the skipIfInheritdoc sniff property to "true" to skip checking function comments if the content is only {[@&#8203;inhertidoc](https://github.com/inhertidoc)} - The default remains at "false", so these comments will continue to report errors - Thanks to \[Jess Myrbo]\[[@&#8203;xjm](https://github.com/xjm)] for the patch - Squiz.Commenting.FunctionComment now supports the PHP 8 mixed type - Thanks to \[Vadim Borodavko]\[[@&#8203;javer](https://github.com/javer)] for the patch - Squiz.PHP.NonExecutableCode now has improved handling of syntax errors - Thanks to \[Thiemo Kreuz]\[[@&#8203;thiemowmde](https://github.com/thiemowmde)] for the patch - Squiz.WhiteSpace.ScopeKeywordSpacing now checks spacing when using PHP 8.0 constructor property promotion - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Fixed - Fixed an issue that could occur when checking files on network drives, such as with WSL2 on Windows 10 - This works around a long-standing PHP bug with is_readable() - Thanks to \[Michael S]\[[@&#8203;codebymikey](https://github.com/codebymikey)] for the patch - Fixed a number of false positives in the Squiz.PHP.DisallowMultipleAssignments sniff - Sniff no longer errors for default value assignments in arrow functions - Sniff no longer errors for assignments on first line of closure - Sniff no longer errors for assignments after a goto label - Thanks to \[Jaroslav Hanslík]\[[@&#8203;kukulich](https://github.com/kukulich)] for the patch - Fixed bug [#&#8203;2913][sq-2913] : Generic.WhiteSpace.ScopeIndent false positive when opening and closing tag on same line inside conditional - Fixed bug [#&#8203;2992][sq-2992] : Enabling caching using a ruleset produces invalid cache files when using --sniffs and --exclude CLI args - Fixed bug [#&#8203;3003][sq-3003] : Squiz.Formatting.OperatorBracket autofix incorrect when assignment used with null coalescing operator - Fixed bug [#&#8203;3145][sq-3145] : Autoloading of sniff fails when multiple classes declared in same file - Fixed bug [#&#8203;3157][sq-3157] : PSR2.ControlStructures.SwitchDeclaration.BreakIndent false positive when case keyword is not indented - Fixed bug [#&#8203;3163][sq-3163] : Undefined index error with pre-commit hook using husky on PHP 7.4 - Thanks to \[Ismo Vuorinen]\[[@&#8203;ivuorinen](https://github.com/ivuorinen)] for the patch - Fixed bug [#&#8203;3165][sq-3165] : Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure - Fixed bug [#&#8203;3167][sq-3167] : Generic.WhiteSpace.ScopeIndent false positive when using PHP 8.0 constructor property promotion - Fixed bug [#&#8203;3170][sq-3170] : Squiz.WhiteSpace.OperatorSpacing false positive when using negation with string concat - This also fixes the same issue in the PSR12.Operators.OperatorSpacing sniff - Fixed bug [#&#8203;3177][sq-3177] : Incorrect tokenization of GOTO statements in mixed PHP/HTML files - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3184][sq-3184] : PSR2.Namespace.NamespaceDeclaration false positive on namespace operator - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3188][sq-3188] : Squiz.WhiteSpace.ScopeKeywordSpacing false positive for static return type - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3192][sq-3192] : findStartOfStatement doesn't work correctly inside switch - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch - Fixed bug [#&#8203;3195][sq-3195] : Generic.WhiteSpace.ScopeIndent confusing message when combination of tabs and spaces found - Fixed bug [#&#8203;3197][sq-3197] : Squiz.NamingConventions.ValidVariableName does not use correct error code for all member vars - Fixed bug [#&#8203;3219][sq-3219] : Generic.Formatting.MultipleStatementAlignment false positive for empty anonymous classes and closures - Fixed bug [#&#8203;3258][sq-3258] : Squiz.Formatting.OperatorBracket duplicate error messages for unary minus - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3273][sq-3273] : Squiz.Functions.FunctionDeclarationArgumentSpacing reports line break as 0 spaces between parenthesis - Fixed bug [#&#8203;3277][sq-3277] : Nullable static return typehint causes whitespace error - Fixed bug [#&#8203;3284][sq-3284] : Unused parameter false positive when using array index in arrow function [sq-2913]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2913 [sq-2992]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2992 [sq-3003]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3003 [sq-3145]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3145 [sq-3157]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3157 [sq-3163]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3163 [sq-3165]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3165 [sq-3167]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3167 [sq-3170]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3170 [sq-3177]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3177 [sq-3184]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3184 [sq-3188]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3188 [sq-3192]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3192 [sq-3195]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3195 [sq-3197]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3197 [sq-3219]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3219 [sq-3258]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3258 [sq-3273]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3273 [sq-3277]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3277 [sq-3284]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3284 ### [`v3.5.8`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#358---2020-10-23) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.5.7...3.5.8) ##### Removed - Reverted a change to the way include/exclude patterns are processed for STDIN content - This change is not backwards compatible and will be re-introduced in version 3.6.0 ### [`v3.5.7`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#357---2020-10-23) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.5.6...3.5.7) ##### Added - The PHP 8.0 T_NULLSAFE_OBJECT_OPERATOR token has been made available for older versions - Existing sniffs that check for T_OBJECT_OPERATOR have been modified to apply the same rules for the nullsafe object operator - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The new method of PHP 8.0 tokenizing for namespaced names has been reverted to the pre 8.0 method - This maintains backwards compatible for existing sniffs on PHP 8.0 - This change will be removed in PHPCS 4.0 as the PHP 8.0 tokenizing method will be backported for pre 8.0 versions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for changes to the way PHP 8.0 tokenizes hash comments - The existing PHP 5-7 behaviour has been replicated for version 8, so no sniff changes are required - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Running the unit tests now includes warnings in the found and fixable error code counts \- Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - PSR12.Functions.NullableTypeDeclaration now supports the PHP8 static return type - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Changed - The autoloader has been changed to fix sniff class name detection issues that may occur when running on PHP 7.4+ - Thanks to \[Eloy Lafuente]\[[@&#8203;stronk7](https://github.com/stronk7)] for the patch - PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed error message is now more accurate when using the allowOnly setting - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch ##### Fixed - Fixed Squiz.Formatting.OperatorBracket false positive when exiting with a negative number - Fixed Squiz.PHP.DisallowComparisonAssignment false positive for methods called on an object - Fixed bug [#&#8203;2882][sq-2882] : Generic.Arrays.ArrayIndent can request close brace indent to be less than the statement indent level - Fixed bug [#&#8203;2883][sq-2883] : Generic.WhiteSpace.ScopeIndent.Incorrect issue after NOWDOC - Fixed bug [#&#8203;2975][sq-2975] : Undefined offset in PSR12.Functions.ReturnTypeDeclaration when checking function return type inside ternary - Fixed bug [#&#8203;2988][sq-2988] : Undefined offset in Squiz.Strings.ConcatenationSpacing during live coding - Thanks to \[Thiemo Kreuz]\[[@&#8203;thiemowmde](https://github.com/thiemowmde)] for the patch - Fixed bug [#&#8203;2989][sq-2989] : Incorrect auto-fixing in Generic.ControlStructures.InlineControlStructure during live coding - Thanks to \[Thiemo Kreuz]\[[@&#8203;thiemowmde](https://github.com/thiemowmde)] for the patch - Fixed bug [#&#8203;3007][sq-3007] : Directory exclude pattern improperly excludes directories with names that start the same - Thanks to \[Steve Talbot]\[[@&#8203;SteveTalbot](https://github.com/SteveTalbot)] for the patch - Fixed bug [#&#8203;3043][sq-3043] : Squiz.WhiteSpace.OperatorSpacing false positive for negation in arrow function - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3049][sq-3049] : Incorrect error with arrow function and parameter passed as reference - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3053][sq-3053] : PSR2 incorrect fix when multiple use statements on same line do not have whitespace between them - Fixed bug [#&#8203;3058][sq-3058] : Progress gets unaligned when 100% happens at the end of the available dots - Fixed bug [#&#8203;3059][sq-3059] : Squiz.Arrays.ArrayDeclaration false positive when using type casting - Thanks to \[Sergei Morozov]\[[@&#8203;morozov](https://github.com/morozov)] for the patch - Fixed bug [#&#8203;3060][sq-3060] : Squiz.Arrays.ArrayDeclaration false positive for static functions - Thanks to \[Sergei Morozov]\[[@&#8203;morozov](https://github.com/morozov)] for the patch - Fixed bug [#&#8203;3065][sq-3065] : Should not fix Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma if comment between element and comma - Thanks to \[Sergei Morozov]\[[@&#8203;morozov](https://github.com/morozov)] for the patch - Fixed bug [#&#8203;3066][sq-3066] : No support for namespace operator used in type declarations - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3075][sq-3075] : PSR12.ControlStructures.BooleanOperatorPlacement false positive when operator is the only content on line - Fixed bug [#&#8203;3099][sq-3099] : Squiz.WhiteSpace.OperatorSpacing false positive when exiting with negative number - Thanks to \[Sergei Morozov]\[[@&#8203;morozov](https://github.com/morozov)] for the patch - Fixed bug [#&#8203;3102][sq-3102] : PSR12.Squiz.OperatorSpacing false positive for default values of arrow functions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;3124][sq-3124] : PSR-12 not reporting error for empty lines with only whitespace - Fixed bug [#&#8203;3135][sq-3135] : Ignore annotations are broken on PHP 8.0 - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-2882]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2882 [sq-2883]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2883 [sq-2975]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2975 [sq-2988]: https://github.com/squizlabs/PHP_CodeSniffer/pull/2988 [sq-2989]: https://github.com/squizlabs/PHP_CodeSniffer/pull/2989 [sq-3007]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3007 [sq-3043]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3043 [sq-3049]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3049 [sq-3053]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3053 [sq-3058]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3058 [sq-3059]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3059 [sq-3060]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3060 [sq-3065]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3065 [sq-3066]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3066 [sq-3075]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3075 [sq-3099]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3099 [sq-3102]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3102 [sq-3124]: https://github.com/squizlabs/PHP_CodeSniffer/issues/3124 [sq-3135]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3135 ### [`v3.5.6`](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/CHANGELOG.md#356---2020-08-10) [Compare Source](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.5.5...3.5.6) ##### Added - Added support for PHP 8.0 magic constant dereferencing - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Added support for changes to the way PHP 8.0 tokenizes comments - The existing PHP 5-7 behaviour has been replicated for version 8, so no sniff changes are required - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - `File::getMethodProperties()` now detects the PHP 8.0 static return type - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - The PHP 8.0 static return type is now supported for arrow functions - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch ##### Changed - The cache is no longer used if the list of loaded PHP extensions changes - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - `Generic.NamingConventions.CamelCapsFunctionName` no longer reports `__serialize` and `__unserialize` as invalid names - Thanks to \[Filip Š]\[[@&#8203;filips123](https://github.com/filips123)] for the patch - `PEAR.NamingConventions.ValidFunctionName` no longer reports `__serialize` and `__unserialize` as invalid names - Thanks to \[Filip Š]\[[@&#8203;filips123](https://github.com/filips123)] for the patch - `Squiz.Scope.StaticThisUsage` now detects usage of `$this` inside closures and arrow functions - Thanks to \[Michał Bundyra]\[[@&#8203;michalbundyra](https://github.com/michalbundyra)] for the patch ##### Fixed - Fixed bug [#&#8203;2877][sq-2877] : PEAR.Functions.FunctionCallSignature false positive for array of functions - Thanks to \[Vincent Langlet]\[[@&#8203;VincentLanglet](https://github.com/VincentLanglet)] for the patch - Fixed bug [#&#8203;2888][sq-2888] : PSR12.Files.FileHeader blank line error with multiple namespaces in one file - Fixed bug [#&#8203;2926][sq-2926] : phpcs hangs when using arrow functions that return heredoc - Fixed bug [#&#8203;2943][sq-2943] : Redundant semicolon added to a file when fixing PSR2.Files.ClosingTag.NotAllowed - Fixed bug [#&#8203;2967][sq-2967] : Markdown generator does not output headings correctly - Thanks to \[Petr Bugyík]\[[@&#8203;o5](https://github.com/o5)] for the patch - Fixed bug [#&#8203;2977][sq-2977] : File::isReference() does not detect return by reference for closures - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch - Fixed bug [#&#8203;2994][sq-2994] : Generic.Formatting.DisallowMultipleStatements false positive for FOR loop with no body - Fixed bug [#&#8203;3033][sq-3033] : Error generated during tokenizing of goto statements on PHP 8 - Thanks to \[Juliette Reinders Folmer]\[[@&#8203;jrfnl](https://github.com/jrfnl)] for the patch [sq-2877]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2877 [sq-2888]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2888 [sq-2926]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2926 [sq-2943]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2943 [sq-2967]: https://github.com/squizlabs/PHP_CodeSniffer/pull/2967 [sq-2977]: https://github.com/squizlabs/PHP_CodeSniffer/pull/2977 [sq-2994]: https://github.com/squizlabs/PHP_CodeSniffer/issues/2994 [sq-3033]: https://github.com/squizlabs/PHP_CodeSniffer/pull/3033 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuOCIsInVwZGF0ZWRJblZlciI6IjM5LjE4NS44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
chore(deps): update dependency squizlabs/php_codesniffer to v3.11.3
Some checks failed
renovate/artifacts Artifact file update failure
4134d29a67
renovate-bot force-pushed renovate/squizlabs-php_codesniffer-3.x-lockfile from 4134d29a67 to 1444dbe6db 2025-03-12 12:09:00 +00:00 Compare
kumi merged commit 63a3f20507 into main 2025-03-12 12:10:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: kumi/alltube-library#6
No description provided.