PackageTrack
Sign in Get early access

squizlabs/php_codesniffer

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

4.0.4 398M downloads/mo #174 most downloaded on composer PHPCSStandards/PHP_CodeSniffer

What this package is like to depend on

Last release 17 days ago

06 Aug 2026

Ships unpredictably

gaps range from 8 days to 9 months

Rarely documented

notes for 9 of 108 stable releases

Nothing withdrawn

no release was ever pulled

14 years old

109 releases · first in 2012

8 releases in the last 12 months

see the full history below

Release timeline

109 releases · Nov 2012 to Aug 2026
2013 2015 2017 2019 2021 2023 2025
Release Pre-release

Releases

latest 60 of 109
  1. 4.0.4 06 Aug 2026
    Release notes

    The 4.0.2 release, the 4.0.3 and the 4.0.4 release are 100% the same (aside from the version number), there was just a slight snafu in the release publication on GitHub (missing PHAR assets). Sorry for the confusion.

    Open source →
    Release notes

    4.0.4 - 2026-08-06 Latest

    Latest

    Compare

    Choose a tag to compare

    Open source →
  2. 4.0.2 06 Aug 2026
    Release notes

    This is a security release and all users are advised to update their install(s) as soon as possible.
    The security issue only affects users of the Gitblame, Hgblame or Svnblame report(s).

    Added

    • Tokenizer support for the PHP 8.5 (void) cast. #1325
      The T_VOID_CAST token has been added to the Tokens::CAST_TOKENS array.
    • suggest section to the composer.json file to inform users about the recommended iconv and pcntl PHP extensions. #1388

    Changed

    • Clarified that libxml is a required PHP extension. #1409
    • Squiz.Scope.StaticThisUsage: the sniff will now also search for the use of $this in static closures. #1377
    • The Generic.PHP.LowerCaseKeyword, Generic.WhiteSpace.LanguageConstructSpacing and Squiz.Functions.FunctionDeclarationArgumentSpacing sniffs no longer embed UTF-8 middot characters for spaces in error messages. #1379, #1389 Fixes Squiz/#2652.
    • PSR2.ControlStructures.SwitchDeclaration: the error message for the use of colon + curly braces (WrongOpener*) has been made more informative. #1358. Fixes #1322.
    • The error messages for the following sniffs have been improved by exposing more data placeholders:
      • PEAR.Functions.FunctionDeclaration #1445
        • The CloseBracketLine error message now exposes 1 data value (previously 0).
        • The EmptyLine error message now exposes 1 data value (previously 0).
        • The Indent error message now exposes 3 data values (previously 2).
        • These changes also affect the same error codes for the PSR12.Classes.AnonClassDeclaration and Squiz.Functions.MultiLineFunctionDeclaration sniffs.
      • PSR2.Classes.ClassDeclaration #1446
        • The ExtendsLine and ImplementsLine error messages now expose 3 data values (previously 1).
        • The SpaceBeforeExtends and SpaceBeforeImplements error messages now expose 2 data values (previously 1).
        • These changes also affect the same error codes for the PSR12.Classes.AnonClassDeclaration and Squiz.Classes.ClassDeclaration sniffs.
      • PSR2.ControlStructures.SwitchDeclaration #1447
        • The defaultNotLower and caseNotLower error messages now expose 3 data values (previously 2).
        • The SpaceBeforeColonDEFAULT and SpaceBeforeColonCASE error messages now expose 1 data value (previously 0).
        • The BodyOnNextLineDEFAULT and BodyOnNextLineCASE error messages now expose 1 data value (previously 0).
        • The WrongOpenerdefault and WrongOpenercase error messages now expose 1 data value (previously 0).
      • Squiz.ControlStructures.SwitchDeclaration #1449
        • The CaseNotLower and DefaultNotLower error messages now expose 3 data values (previously 2).
        • The CaseIndent and DefaultIndent error messages now expose 2 data values (previously 0).
        • The SpaceBeforeColonCase and SpaceBeforeColonDefault error messages now expose 1 data value (previously 0).
        • The BreakIndent error message now exposes 1 data value (previously 0).
        • The SpacingAfterCase and SpacingAfterDefault error messages now expose 1 data value (previously 0).
      • Squiz.Functions.FunctionDeclarationArgumentSpacing #1452
        • The SpaceBeforeEquals error message now exposes 3 data values (previously 2).
        • The SpaceAfterEquals error message now exposes 3 data values (previously 2).
      • Squiz.Functions.MultiLineFunctionDeclaration #1453
        • The FirstParamSpacing and UseFirstParamSpacing error messages now expose 1 data value (previously 0).
        • The OneParamPerLine and UseOneParamPerLine error messages now expose 1 data value (previously 0).
        • These changes also affect the same error codes for the PSR12.Classes.AnonClassDeclaration sniff.
      • If you have customised the error messages of these sniffs, please review your ruleset after upgrading.
      • Thanks to Zhang WenTao for these patches.
    • The following sniff(s) have received efficiency improvements:
      • PSR2.Classes.PropertyDeclaration
      • Thanks to Jonathan Champ for the patch.
    • The test suite is now more contributor friendly for contributors on MacOS. #1437
    • Various housekeeping, including improvements to the tests and documentation.

    Fixed

    • SECURITY FIX: Running PHP_CodeSniffer over untrusted files, for example, in a CI pipeline that scans pull requests, or on a developer machine reviewing third-party code, could result in attacker-controlled shell commands being executed when the Gitblame, Hgblame or Svnblame report(s) would process a file whose name contains shell metacharacters. #1473
    • Fixed bug #1320: Generic.Strings.UnnecessaryHeredoc: the fixer could incidentally change tab indentation to space indentation in select lines in the heredoc body.
    • Fixed bug #1354: PSR12.Functions.ReturnTypeDeclaration: prevent an "Undefined array key" warning if the code under scan contains a parse error.
    • Fixed bug #1357: Squiz.Scope.StaticThisUsage: false positive for usage of $this in non-static closures nested in OO methods.
    • Fixed bug #1368: PEAR.Functions.FunctionDeclaration: the indentation for subsequent lines in multi-line block comments within a multi-line function signature, would be incorrectly determined, leading to false positives and resulting in a fixer conflict when running phpcbf.
      • This also fixes, by extension, the same issue in the Squiz.Functions.MultiLineFunctionDeclaration sniff.
    • Fixed bug #1418: Tokenizer/PHP: tokenization of an inline else colon after an inline comment could fail and/or throw a "Trying to access array offset on null" warning.
    • Fixed bug #1435: Generic.Formatting.MultipleStatementAlignment would get into a fixer conflict for multiple assignments within a single statement spanning multiple lines.
      • Same as when the statement would be single-line, alignment of subsequent assignment operators within the same multi-line statement will now be ignored.
      • Thanks to Sergei Morozov for the patch.
    • Fixed bug #1451: Tokenizer/PHP: prevent an "Undefined array key" warning during live coding when a file ends on the name in a constant declaration.
    • Fixed bug #1463: Squiz.Functions.FunctionDuplicateArgument: prevent an "Undefined array key" PHP warning when the sniff encounters a function declaration without parentheses (parse error / live coding).

    Other

    • The GPG signature for the PHAR files has been rotated. The new fingerprint is: 5CB4F778BF9BC4FB67AE511D96E91A992CF22FF4.

    New Contributors

    The PHP_CodeSniffer project is happy to welcome the following new contributors:
    @bigdevlarry, @Faze-up, @jrchamp, @lazerg, @morozov, @ntdiary, @SAY-5

    Statistics

    Closed: 10 issues
    Merged: 33 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    4.0.2 - 2026-08-06

    Compare

    Choose a tag to compare

    Open source →
  3. 4.0.1 10 Nov 2025
    Release notes

    This release includes all improvements and bugfixes from PHP_CodeSniffer 3.13.5.

    Added

    • Runtime support for PHP 8.5. All known PHP 8.5 deprecation notices have been fixed.
      • Syntax support for new PHP 8.5 features will follow in a future release.
      • If you find any PHP 8.5 deprecation notices which were missed, please report them.

    Changed

    • The Squiz.ControlStructures.SwitchDeclaration sniff will now flag a PHP close tag as a "wrong opener" and will auto-fix this by inserting a colon. #1316
    • Various housekeeping, including improvements to the tests and documentation.

    Fixed

    • 4.x regression #1277: bring back whitespace tolerance in phpcs:ignore comma-separated rule reference lists.
      • Note: this bug did not affect phpcs:disable/phpcs:enable ignore annotations.
    • Fixed bug #968: Generic.WhiteSpace.ScopeIndent was reporting false positives - and making incorrect fixes - for lines following a line containing an arrow function.
    • Fixed bug #1216: Tokenizer/PHP: added more defensive coding to prevent PHP 8.5 "Using null as an array offset" deprecation notices.
    • Fixed bug #1279: Tokenizer/PHP: on PHP < 8.0, an unclosed attribute (parse error) could end up removing some tokens from the token stream.
      • This could lead to false positives and false negative from sniffs, but could also lead to incorrect fixes being made mangling the file under scan.
    • Fixed bug #1315: Squiz.ControlStructures.SwitchDeclaration: a number of the fixers would get into fixer conflicts with each other if the code under scan contained multiple statements on a line within a switch.
      • The sniff will now forbid - and auto-fix - multiple statements on one line for case/default and "case breaking" statements.
    • Fixed bug #1316: Tokenizer/PHP: a PHP close tag after a switch case condition or after a default keyword, was not regarded as a "scope_opener" for the case/default body.
    • Fixed bug #1316: PSR2.ControlStructures.SwitchDeclaration: the WrongOpener error is now also auto-fixable if the wrong opener is a PHP close tag.
    • Fixed bug #1316: Squiz.PHP.NonExecutableCode would throw false positives when code within a switch control structure would move in and out of PHP.

    New Contributors

    The PHP_CodeSniffer project is happy to welcome the following new contributors:
    @andrewnicols, @Soh1121

    Statistics

    Closed: 2 issues
    Merged: 8 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    4.0.1 - 2025-11-10

    Compare

    Choose a tag to compare

    Open source →
  4. 4.0.0 15 Sep 2025
    Release notes

    This release contains breaking changes.

    Upgrade guides for both ruleset maintainers/end-users, as well as for sniff developers and integrators, have been published to the Wiki.

    You are strongly encouraged to read the upgrade guide applicable to your situation before upgrading.

    This release includes all improvements and bugfixes from PHP_CodeSniffer 4.0.0-beta1, 4.0.0-RC1, 3.13.3 and 3.13.4.

    Changed

    • Tokenizer/PHP: fully qualified exit/die/true/false/null will be tokenized as the keyword token and the token 'content' will include the leading backslash. #1201
    • Wherever possible based on the PHP 7.2 minimum version, parameter types have been added to all methods. #1237
    • The supported PHPUnit version constraints have been updated to ^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31. #1247
      • External standards using the PHP_CodeSniffer native framework may need to update their own PHPUnit version constraints.
    • Various housekeeping, including improvements to the tests and documentation.

    Fixed

    • Fixed bug #1082: new exit codes weren't applied when running phpcbf on code provided via STDIN.
    • Fixed bug #1172: // phpcs:set for inline array properties did not handle a single item array with the value true, false or null correctly.
    • Fixed bug #1174: progress bar wasn't showing files as fixed when running phpcbf in parallel mode.
    • Fixed bug #1226: PHP 8.5 "Using null as an array offset" deprecation notice.

    Other

    • Please be aware that the master branch has been renamed to 3.x and the default branch has changed to the 4.x branch.
      • If you contribute to PHP_CodeSniffer, you will need to update your local git clone.
      • If you develop against PHP_CodeSniffer and run your tests against dev branches of PHPCS, you will need to update your workflows.

    Statistics

    Closed: 5 issues
    Merged: 35 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    4.0.0 - 2025-09-16

    Compare

    Choose a tag to compare

    Open source →
  5. 4.0.0-RC1 17 Jun 2025 pre-release

    Nothing published for this version

  6. 3.13.6 06 Aug 2026
    Release notes

    This is a security release and all users are advised to update their install(s) as soon as possible.

    Changed

    Fixed

    • SECURITY FIX: Running PHP_CodeSniffer over untrusted files, for example, in a CI pipeline that scans pull requests, or on a developer machine reviewing third-party code, could result in attacker-controlled shell commands being executed when the Gitblame, Hgblame or Svnblame report(s) would process a file whose name contains shell metacharacters. #1473

    Other

    • The GPG signature for the PHAR files has been rotated. The new fingerprint is: 5CB4F778BF9BC4FB67AE511D96E91A992CF22FF4.

    Statistics

    Closed: 0 issues
    Merged: 46 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    3.13.6 - 2026-08-06

    Compare

    Choose a tag to compare

    Open source →
  7. 3.13.5 04 Nov 2025
    Release notes

    Added

    • Runtime support for PHP 8.5. All known PHP 8.5 deprecation notices have been fixed.
      • Syntax support for new PHP 8.5 features will follow in a future release.
      • If you find any PHP 8.5 deprecation notices which were missed, please report them.

    Changed

    Fixed

    • Fixed bug #1216: Tokenizer/PHP: added more defensive coding to prevent PHP 8.5 "Using null as an array offset" deprecation notices.
    • Fixed bug #1279: Tokenizer/PHP: on PHP < 8.0, an unclosed attribute (parse error) could end up removing some tokens from the token stream.
      • This could lead to false positives and false negative from sniffs, but could also lead to incorrect fixes being made mangling the file under scan.
      • Thanks to Juliette Reinders Folmer for the patch.

    Other

    • Please be aware that the master branch has been renamed to 3.x and the default branch has changed to the 4.x branch.
      • If you contribute to PHP_CodeSniffer, you will need to update your local git clone.
      • If you develop against PHP_CodeSniffer and run your tests against dev branches of PHPCS, you will need to update your workflows.

    New Contributors

    The PHP_CodeSniffer project is happy to welcome the following new contributors:
    @andrewnicols

    Statistics

    Closed: 2 issues
    Merged: 36 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    3.13.5 - 2025-11-04

    Compare

    Choose a tag to compare

    Open source →
  8. 3.13.4 05 Sep 2025
    Release notes

    Fixed

    • Fixed bug #1213: ability to run tests for external standards using the PHPCS native test framework was broken.
    • Fixed bug #1215: PHP 8.5 "Using null as an array offset" deprecation notices.

    Statistics

    Closed: 0 issues
    Merged: 3 pull requests

    If you like to stay informed about releases and more, follow @phpcs on Mastodon or @PHP_CodeSniffer on X.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    3.13.4 - 2025-09-05

    Compare

    Choose a tag to compare

    Open source →
  9. 3.13.3 04 Sep 2025
    Release notes

    Added

    • Tokenizer support for PHP 8.4 dereferencing of new expressions without wrapping parentheses. #1160
    • Tokenizer support for PHP 8.4 abstract properties. #1183
      • The File::getMemberProperties() method now also supports abstract properties through a new is_abstract array index in the return value. #1184
      • Additionally, the following sniffs have been updated to support abstract properties:
        • Generic.PHP.LowerCaseConstant #1185
        • Generic.PHP.UpperCaseConstant #1185
        • PSR2.Classes.PropertyDeclaration #1188
        • Squiz.Commenting.VariableComment #1186
        • Squiz.WhiteSpace.MemberVarSpacing #1187
      • Thanks to Juliette Reinders Folmer for the patches
    • Tokenizer support for the PHP 8.4 "exit as a function call" change. #1201
      • When exit/die is used as a fully qualified "function call", it will now be tokenized as T_NS_SEPARATOR + T_EXIT.
      • Additionally, the following sniff has been updated to handle fully qualified exit/die correctly:
        • Squiz.PHP.NonExecutableCode
      • Thanks to Juliette Reinders Folmer for the patches

    Changed

    • Tokenizer/PHP: fully qualified true/false/null will now be tokenized as T_NS_SEPARATOR + T_TRUE/T_FALSE/T_NULL. #1201
      • Previously, these were tokenized as T_NS_SEPARATOR + T_STRING.
      • Additionally, the following sniffs have been updated to handle fully qualified true/false/null correctly:
        • Generic.CodeAnalysis.UnconditionalIfStatement
        • Generic.ControlStructures.DisallowYodaConditions
        • PEAR.Functions.ValidDefaultValue
      • Thanks to Juliette Reinders Folmer for the patches.
    • Generic.PHP.Syntax: the sniff is now able to scan input provided via STDIN on non-Windows OSes. #915
    • PSR2.ControlStructures.SwitchDeclaration: the WrongOpener* error code is now auto-fixable if the identified "wrong opener" is a semi-colon. #1161
    • The PSR2.Classes.PropertyDeclaration will now check that the abstract modifier keyword is placed before a visibility keyword. #1188
      • Errors will be reported via a new AbstractAfterVisibility error code.
      • Thanks to Juliette Reinders Folmer for the patch.
    • Various housekeeping, including improvements to the tests and documentation.

    Fixed

    • Fixed bug #1112 : --parallel option fails if PHP_CodeSniffer is invoked via bash and the invokation creates a non-PHPCS-managed process.
    • Fixed bug #1113 : fatal error when the specified "files to scan" would result in the same file being added multiple times to the queue.
      • This error only occured when --parallel scanning was enabled.
      • Thanks to Rodrigo Primo for the patch.
    • Fixed bug #1154 : PEAR.WhiteSpace.ObjectOperatorIndent: false positive when checking multiple chained method calls in a multidimensional array.
    • Fixed bug #1193 : edge case inconsistency in how empty string array keys for sniff properties are handled.
    • Fixed bug #1197 : Squiz.Commenting.FunctionComment: return types containing a class name with underscores would be truncated leading to incorrect results.

    Other


    New Contributors

    The PHP_CodeSniffer project is happy to welcome the following new contributors:
    @benno5020, @NanoSector

    Statistics

    Closed: 11 issues
    Merged: 40 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    3.13.3 - 2025-09-04

    Compare

    Choose a tag to compare

    Open source →
  10. 3.13.2 17 Jun 2025
    Release notes

    Changed

    • The documentation for the following sniffs has been improved:
      • Squiz.Classes.SelfMemberReference
      • Thanks to Rodrigo Primo for the patch.
    • Various housekeeping, including improvements to the tests and documentation.

    Fixed

    • Fixed bug #1135 : Squiz.Functions.FunctionDeclarationArgumentSpacing: typo in new error code SpacingAfterSetVis[i]bility.

    Statistics

    Closed: 0 issues
    Merged: 6 pull requests

    Follow @phpcs on Mastodon or @PHP_CodeSniffer on X to stay informed.

    Please consider funding the PHP_CodeSniffer project. If you already do so: thank you!

    Open source →
    Release notes

    3.13.2 - 2025-06-18

    Compare

    Choose a tag to compare

    Open source →
  11. 3.13.1 12 Jun 2025

    Nothing published for this version

  12. 3.13.0 11 May 2025

    Nothing published for this version

  13. 3.12.2 13 Apr 2025

    Nothing published for this version

  14. 3.12.1 04 Apr 2025

    Nothing published for this version

  15. 3.12.0 18 Mar 2025

    Nothing published for this version

  16. 3.11.3 23 Jan 2025

    Nothing published for this version

  17. 3.11.2 11 Dec 2024

    Nothing published for this version

  18. 3.11.1 16 Nov 2024

    Nothing published for this version

  19. 3.11.0 12 Nov 2024

    Nothing published for this version

  20. 3.10.3 18 Sep 2024

    Nothing published for this version

  21. 3.10.2 21 Jul 2024

    Nothing published for this version

  22. 3.10.1 22 May 2024

    Nothing published for this version

  23. 3.10.0 20 May 2024

    Nothing published for this version

  24. 3.9.2 23 Apr 2024

    Nothing published for this version

  25. 3.9.1 31 Mar 2024

    Nothing published for this version

  26. 3.9.0 16 Feb 2024

    Nothing published for this version

  27. 3.8.1 11 Jan 2024

    Nothing published for this version

  28. 3.8.0 08 Dec 2023

    Nothing published for this version

  29. 3.7.2 22 Feb 2023

    Nothing published for this version

  30. 3.7.1 18 Jun 2022

    Nothing published for this version

  31. 3.7.0 13 Jun 2022

    Nothing published for this version

  32. 3.6.2 12 Dec 2021

    Nothing published for this version

  33. 3.6.1 11 Oct 2021

    Nothing published for this version

  34. 3.6.0 09 Apr 2021

    Nothing published for this version

  35. 3.5.8 23 Oct 2020

    Nothing published for this version

  36. 3.5.7 22 Oct 2020

    Nothing published for this version

  37. 3.5.6 10 Aug 2020

    Nothing published for this version

  38. 3.5.5 17 Apr 2020

    Nothing published for this version

  39. 3.5.4 30 Jan 2020

    Nothing published for this version

  40. 3.5.3 04 Dec 2019

    Nothing published for this version

  41. 3.5.2 28 Oct 2019

    Nothing published for this version

  42. 3.5.1 16 Oct 2019

    Nothing published for this version

  43. 3.5.0 26 Sep 2019

    Nothing published for this version

  44. 3.4.2 10 Apr 2019

    Nothing published for this version

  45. 3.4.1 19 Mar 2019

    Nothing published for this version

  46. 3.4.0 19 Dec 2018

    Nothing published for this version

  47. 3.3.2 23 Sep 2018

    Nothing published for this version

  48. 3.3.1 26 Jul 2018

    Nothing published for this version

  49. 3.3.0 06 Jun 2018

    Nothing published for this version

  50. 3.2.3 20 Feb 2018

    Nothing published for this version

  51. 3.2.2 19 Dec 2017

    Nothing published for this version

  52. 3.2.1 18 Dec 2017

    Nothing published for this version

  53. 3.2.0 12 Dec 2017

    Nothing published for this version

  54. 3.1.1 16 Oct 2017

    Nothing published for this version

  55. 3.1.0 19 Sep 2017

    Nothing published for this version

  56. 3.0.2 18 Jul 2017

    Nothing published for this version

  57. 3.0.1 14 Jun 2017

    Nothing published for this version

  58. 3.0.0 04 May 2017

    Nothing published for this version

  59. 2.9.2 07 Nov 2018

    Nothing published for this version

  60. 2.9.1 22 May 2017

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive