All Versions
14
Latest Version
Avg Release Cycle
61 days
Latest Release
774 days ago

Changelog History
Page 2

  • v3.4.1 Changes

    March 19, 2019

    Note for PEAR Users

    πŸš€ The PEAR installable version of PHPCS was missing some files, which have been re-included in this release. The result of these omissions were:

    • The code report was not previously available for PEAR installs
    • The Generic.Formatting.SpaceBeforeCast sniff was not previously available for PEAR installs
    • The Generic.WhiteSpace.LanguageConstructSpacing sniff was not previously available for PEAR installs

    Thanks to Juliette Reinders Folmer for the patch

    πŸ”„ Changelog

    • PHPCS will now refuse to run if any of the required PHP extensions are not loaded
      • Previously, PHPCS only relied on requirements being checked by PEAR and Composer
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ“œ Ruleset XML parsing errors are now displayed in a readable format so they are easier to correct
      • Thanks to Juliette Reinders Folmer for the patch
    • The PSR2 standard no longer throws duplicate errors for spacing around FOR loop parentheses
      • Thanks to Juliette Reinders Folmer for the patch
    • T_PHPCS_SET tokens now contain sniffCode, sniffProperty, and sniffPropertyValue indexes
      • Sniffs can use this information instead of having to parse the token content manually
    • βž• Added more guard code for syntax errors to various CSS sniffs
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Commenting.DocComment error messages now contain the name of the comment tag that caused the error
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.ControlStructures.InlineControlStructure now handles syntax errors correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Debug.JSHint now longer requires rhino and can be run directly from the npm install
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Files.LineEndings no longer adds superfluous new line at the end of JS and CSS files
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Formatting.DisallowMultipleStatements no longer tries fix lines containing phpcs:ignore statements
      • Thanks to Juliette Reinders Folmer for the patch
    • 🐎 Generic.Functions.FunctionCallArgumentSpacing now has improved performance and anonymous class support
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.WhiteSpace.ScopeIndent now respects changes to the exact property using phpcs:set mid-way through a file
      • This allows you change the exact rule for only some parts of a file
    • Generic.WhiteSpace.ScopeIndent now disables exact indent checking inside all arrays
      • Previously, this was only done when using long array syntax, but it now works for short array syntax as well
    • PEAR.Classes.ClassDeclaration now has improved handling of PHPCS annotations and tab indents
    • PSR12.Classes.ClassInstantiation has changed it's error code from MissingParenthesis to MissingParentheses
    • PSR12.Keywords.ShortFormTypeKeywords now ignores all spacing inside type casts during both checking and fixing
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.Classes.LowercaseClassKeywords now examines the class keyword for anonymous classes
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ“œ Squiz.ControlStructures.ControlSignature now has improved handling of parse errors
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.Commenting.PostStatementComment fixer no longer adds a blank line at the start of a JS file that begins with a comment
      • Fixes a conflict between this sniff and the Squiz.WhiteSpace.SuperfluousWhitespace sniff
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.Commenting.PostStatementComment now ignores comments inside control structure conditions, such as FOR loops
      • Fixes a conflict between this sniff and the Squiz.ControlStructures.ForLoopDeclaration sniff
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ‘» Squiz.Commenting.FunctionCommentThrowTag now has improved support for unknown exception types and namespaces
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ‘ Squiz.ControlStructures.ForLoopDeclaration has improved whitespace, closure, and empty expression support
      • The SpacingAfterSecondNoThird error code has been removed as part of these fixes
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.CSS.ClassDefinitionOpeningBraceSpace now handles comments and indentation correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.CSS.ClassDefinitionClosingBrace now handles comments, indentation, and multiple statements on the same line correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.CSS.Opacity now handles comments correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.CSS.SemicolonSpacing now handles comments and syntax errors correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ‘ Squiz.NamingConventions.ValidVariableName now supports variables inside anonymous classes correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.PHP.LowercasePHPFunctions now handles use statements, namespaces, and comments correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Squiz.WhiteSpace.FunctionSpacing now fixes function spacing correctly when a function is the first content in a file
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.WhiteSpace.SuperfluousWhitespace no longer throws errors for spacing between functions and properties in anon classes
      • Thanks to Juliette Reinders Folmer for the patch
    • Zend.Files.ClosingTag no longer adds a semi-colon during fixing of a file that only contains a comment
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ‘ Zend.NamingConventions.ValidVariableName now supports variables inside anonymous classes correctly
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2298 : PSR2.Classes.ClassDeclaration allows extended class on new line
      • Thanks to MichaΕ‚ Bundyra for the patch
    • πŸ›  Fixed bug #2337 : Generic.WhiteSpace.ScopeIndent incorrect error when multi-line function call starts on same line as open tag
    • πŸ›  Fixed bug #2348 : Cache not invalidated when changing a ruleset included by another
    • Fixed bug #2376 : Using __halt_compiler() breaks Generic.PHP.ForbiddenFunctions unless it's last in the function list
      • Thanks to Sijun Zhu for the patch
    • πŸ›  Fixed bug #2393 : The gitmodified filter will infinitely loop when encountering deleted file paths
      • Thanks to Lucas Manzke for the patch
    • πŸ›  Fixed bug #2396 : Generic.WhiteSpace.ScopeIndent incorrect error when multi-line IF condition mixed with HTML
    • Fixed bug #2431 : Use function/const not tokenized as T_STRING when preceded by comment
  • v3.4.0 Changes

    December 20, 2018

    πŸ—„ Deprecations

    Generic.Formatting.NoSpaceAfterCast Sniff

    🚚 The Generic.Formatting.NoSpaceAfterCast sniff has been deprecated and will be removed in version 4.

    πŸš€ The functionality of this sniff is now available in the Generic.Formatting.SpaceAfterCast sniff. Include the Generic.Formatting.SpaceAfterCast sniff and set the spacing property to 0 to retain the existing functionality. As soon as possible, replace all instances of the old sniff code with the new sniff code and property setting in your ruleset.xml files. The existing sniff will continue to work until version 4 has been released.

    Other Changes

    • Rule include patterns in a ruleset.xml file are now evaluated as OR instead of AND
      • Previously, a file had to match every include pattern and no exclude patterns to be included
      • Now, a file must match at least one include pattern and no exclude patterns to be included
      • This is a bug fix as include patterns are already documented to work this way
    • New token T_BITWISE_NOT added for the bitwise not operator
      • This token was previously tokenized as T_NONE
      • Any sniffs specifically looking for T_NONE tokens with a tilde as the contents must now also look for T_BITWISE_NOT
      • Sniffs can continue looking for T_NONE as well as T_BITWISE_NOT to support older PHP_CodeSniffer versions
    • All types of binary casting are now tokenized as T_BINARY_CAST
      • Previously, the b in b"some string with $var" would be a T_BINARY_CAST, but only when the string contained a var
      • This change ensures the b is always tokenized as T_BINARY_CAST
      • This change also converts (binary) from T_STRING_CAST to T_BINARY_CAST
      • Thanks to Juliette Reinders Folmer for the help with this patch
    • Array properties set inside a ruleset.xml file can now extend a previous value instead of always overwriting it
      • e.g., if you include a ruleset that defines forbidden functions, can you now add to that list instead of having to redefine it
      • To use this feature, add extend="true" to the property tag
      • e.g., <property name="forbiddenFunctionNames" type="array" extend="true">
      • Thanks to Michael Moravec for the patch
    • If $XDG_CACHE_HOME is set and points to a valid directory, it will be used for caching instead of the system temp directory
    • PHPCBF now disables parallel running if you are passing content on STDIN
      • Stops an error from being shown after the fixed output is printed
    • The progress report now shows files with tokenizer errors as skipped ( S ) instead of a warning ( W )
      • The tokenizer error is still displayed in reports as normal
      • Thanks to Juliette Reinders Folmer for the patch
    • The Squiz standard now ensures there is no space between an increment/decrement operator and its variable
    • The File:: getMethodProperties() method now includes a has_body array index in the return value
      • FALSE if the method has no body (as with abstract and interface methods) or TRUE otherwise
      • Thanks to Chris Wilkinson for the patch
    • πŸ‘» The File::getTokensAsString() method now throws an exception if the $start param is invalid
      • If the $length param is invalid, an empty string will be returned
      • Stops an infinite loop when the function is passed invalid data
      • Thanks to Juliette Reinders Folmer for the patch
    • βž• Added new Generic.CodeAnalysis.EmptyPHPStatement sniff
      • Warns when it finds empty PHP open/close tag combinations or superfluous semicolons
      • Thanks to Juliette Reinders Folmer for the contribution
    • βž• Added new Generic.Formatting.SpaceBeforeCast sniff
      • Ensures there is exactly 1 space before a type cast, unless the cast statement is indented or multi-line
      • Thanks to Juliette Reinders Folmer for the contribution
    • βž• Added new Generic.VersionControl.GitMergeConflict sniff
      • Detects merge conflict artifacts left in files
      • Thanks to Juliette Reinders Folmer for the contribution
    • βž• Added Generic.WhiteSpace.IncrementDecrementSpacing sniff
      • Ensures there is no space between the operator and the variable it applies to
      • Thanks to Juliette Reinders Folmer for the contribution
    • βž• Added PSR12.Functions.NullableTypeDeclaration sniff
      • Ensures there is no space after the question mark in a nullable type declaration
      • Thanks to Timo Schinkel for the contribution
    • πŸ‘ A number of sniffs have improved support for methods in anonymous classes
      • These sniffs would often throw the same error twice for functions in nested classes
      • Error messages have also been changed to be less confusing
      • The full list of affected sniffs is:
      • Generic.NamingConventions.CamelCapsFunctionName
      • PEAR.NamingConventions.ValidFunctionName
      • PSR1.Methods.CamelCapsMethodName
      • PSR2.Methods.MethodDeclaration
      • Squiz.Scope.MethodScope
      • Squiz.Scope.StaticThisUsage
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.CodeAnalysis.UnusedFunctionParameter now only skips functions with empty bodies when the class implements an interface
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.CodeAnalysis.UnusedFunctionParameter now has additional error codes to indicate where unused params were found
      • The new error code prefixes are:
      • FoundInExtendedClass: when the class extends another
      • FoundInImplementedInterface: when the class implements an interface
      • Found: used in all other cases, including closures
      • The new error code suffixes are:
      • BeforeLastUsed: the unused param was positioned before the last used param in the function signature
      • AfterLastUsed: the unused param was positioned after the last used param in the function signature
      • This makes the new error code list for this sniff:
      • Found
      • FoundBeforeLastUsed
      • FoundAfterLastUsed
      • FoundInExtendedClass
      • FoundInExtendedClassBeforeLastUsed
      • FoundInExtendedClassAfterLastUsed
      • FoundInImplementedInterface
      • FoundInImplementedInterfaceBeforeLastUsed
      • FoundInImplementedInterfaceAfterLastUsed
      • These errors code make it easier for specific cases to be ignored or promoted using a ruleset.xml file
      • Thanks to Juliette Reinders Folmer for the contribution
    • Generic.Classes.DuplicateClassName now inspects traits for duplicate names as well as classes and interfaces
      • Thanks to Chris Wilkinson for the patch
    • Generic.Files.InlineHTML now ignores a BOM at the start of the file
      • Thanks to Chris Wilkinson for the patch
    • Generic.PHP.CharacterBeforePHPOpeningTag now ignores a BOM at the start of the file
      • Thanks to Chris Wilkinson for the patch
    • Generic.Formatting.SpaceAfterCast now has a setting to specify how many spaces are required after a type cast
      • Default remains 1
      • Override the spacing setting in a ruleset.xml file to change
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Formatting.SpaceAfterCast now has a setting to ignore newline characters after a type cast
      • Default remains FALSE , so newlines are not allowed
      • Override the ignoreNewlines setting in a ruleset.xml file to change
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Formatting.SpaceAfterNot now has a setting to specify how many spaces are required after a NOT operator
      • Default remains 1
      • Override the spacing setting in a ruleset.xml file to change
      • Thanks to Juliette Reinders Folmer for the patch
    • Generic.Formatting.SpaceAfterNot now has a setting to ignore newline characters after the NOT operator
      • Default remains FALSE , so newlines are not allowed
      • Override the ignoreNewlines setting in a ruleset.xml file to change
      • Thanks to Juliette Reinders Folmer for the patch
    • PEAR.Functions.FunctionDeclaration now checks spacing before the opening parenthesis of functions with no body
      • Thanks to Chris Wilkinson for the patch
    • PEAR.Functions.FunctionDeclaration now enforces no space before the semicolon in functions with no body
      • Thanks to Chris Wilkinson for the patch
    • PSR2.Classes.PropertyDeclaration now checks the order of property modifier keywords
      • This is a rule that is documented in PSR-2 but was not enforced by the included PSR2 standard until now
      • This sniff is also able to fix the order of the modifier keywords if they are incorrect
      • Thanks to Juliette Reinders Folmer for the patch
    • PSR2.Methods.MethodDeclaration now checks method declarations inside traits
      • Thanks to Chris Wilkinson for the patch
    • πŸ‘ Squiz.Commenting.InlineComment now has better detection of comment block boundaries
    • Squiz.Classes.ClassFileName now checks that a trait name matches the filename
      • Thanks to Chris Wilkinson for the patch
    • πŸ‘ Squiz.Classes.SelfMemberReference now supports scoped declarations and anonymous classes
      • Thanks to Juliette Reinders Folmer for the patch
    • 🐎 Squiz.Classes.SelfMemberReference now fixes multiple errors at once, increasing fixer performance
      • Thanks to Gabriel OstroluckΓ½ for the patch
    • πŸ›  Squiz.Functions.LowercaseFunctionKeywords now checks abstract and final prefixes, and auto-fixes errors
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.Objects.ObjectMemberComma.Missing has been renamed to Squiz.Objects.ObjectMemberComma.Found
      • The error is thrown when the comma is found but not required, so the error code was incorrect
      • If you are referencing the old error code in a ruleset XML file, please use the new code instead
      • If you wish to maintain backwards compatibility, you can provide rules for both the old and new codes
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ“œ Squiz.WhiteSpace.ObjectOperatorSpacing is now more tolerant of parse errors
    • πŸ›  Squiz.WhiteSpace.ObjectOperatorSpacing now fixes errors more efficiently
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2109 : Generic.Functions.CallTimePassByReference false positive for bitwise and used in function argument
    • πŸ›  Fixed bug #2165 : Conflict between Squiz.Arrays.ArrayDeclaration and ScopeIndent sniffs when heredoc used in array
    • πŸ›  Fixed bug #2167 : Generic.WhiteSpace.ScopeIndent shows invalid error when scope opener indented inside inline HTML
    • πŸ›  Fixed bug #2178 : Generic.NamingConventions.ConstructorName matches methods in anon classes with same name as containing class
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2190 : PEAR.Functions.FunctionCallSignature incorrect error when encountering trailing PHPCS annotation
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2194 : Generic.Whitespace.LanguageConstructSpacing should not be checking namespace operators
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2202 : Squiz.WhiteSpace.OperatorSpacing throws error for negative index when using curly braces for string access
      • Same issue fixed in Squiz.Formatting.OperatorBracket
      • Thanks to Andreas Buchenrieder for the patch
    • Fixed bug #2210 : Generic.NamingConventions.CamelCapsFunctionName not ignoring SoapClient __getCookies() method
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2211 : PSR2.Methods.MethodDeclaration gets confused over comments between modifier keywords
      • Thanks to Juliette Reinders Folmer for the patch
    • Fixed bug #2212 : FUNCTION and CONST in use groups being tokenised as T_FUNCTION and T_CONST
      • Thanks to Chris Wilkinson for the patch
    • πŸ›  Fixed bug #2214 : File::getMemberProperties() is recognizing method params as properties
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2236 : Memory info measurement unit is Mb but probably should be MB
    • πŸ›  Fixed bug #2246 : CSS tokenizer does not tokenize class names correctly when they contain the string NEW
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2278 : Squiz.Operators.ComparisonOperatorUsage false positive when inline IF contained in parentheses
      • Thanks to Arnout Boks for the patch
    • πŸ›  Fixed bug #2284 : Squiz.Functions.FunctionDeclarationArgumentSpacing removing type hint during fixing
      • Thanks to MichaΕ‚ Bundyra for the patch
    • πŸ›  Fixed bug #2297 : Anonymous class not tokenized correctly when used as argument to another anon class
      • Thanks to MichaΕ‚ Bundyra for the patch
  • v3.3.2 Changes

    September 23, 2018
    • πŸ›  Fixed a problem where the report cache was not being cleared when the sniffs inside a standard were updated
    • The info report (--report=info) now has improved formatting for metrics that span multiple lines
      • Thanks to Juliette Reinders Folmer for the patch
    • βœ… The unit test runner now skips .bak files when looking for test cases
      • Thanks to Juliette Reinders Folmer for the patch
    • The Squiz standard now ensures underscores are not used to indicate visibility of private members vars and methods
      • Previously, this standard enforced the use of underscores
    • Generic.PHP.NoSilencedErrors error messages now contain a code snippet to show the context of the error
      • Thanks to Juliette Reinders Folmer for the patch
    • Squiz.Arrays.ArrayDeclaration no longer reports errors for a comma on a line new after a here/nowdoc
      • Also stops a parse error being generated when auto-fixing
      • The SpaceBeforeComma error message has been changed to only have one data value instead of two
    • Squiz.Commenting.FunctionComment no longer errors when trying to fix indents of multi-line param comments
    • πŸ›  Squiz.Formatting.OperatorBracket now correctly fixes statements that contain strings
    • πŸ’… Squiz.PHP.CommentedOutCode now ignores more @-style annotations and includes better comment block detection
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed a problem where referencing a relative file path in a ruleset XML file could add unnecessary sniff exclusions
      • This didn't actually exclude anything, but caused verbose output to list strange exclusion rules
    • πŸ›  Fixed bug #2110 : Squiz.WhiteSpace.FunctionSpacing is removing indents from the start of functions when fixing
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2115 : Squiz.Commenting.VariableComment not checking var types when the @var line contains a comment
    • Fixed bug #2120 : Tokenizer fails to match T_INLINE_ELSE when used after function call containing closure
    • πŸ›  Fixed bug #2121 : Squiz.PHP.DisallowMultipleAssignments false positive in while loop conditions
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2127 : File::findExtendedClassName() doesn't support nested classes
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #2138 : Tokenizer detects wrong token for php ::class feature with spaces
    • πŸ›  Fixed bug #2143 : PSR2.Namespaces.UseDeclaration does not properly fix "use function" and "use const" statements
      • Thanks to Chris Wilkinson for the patch
    • πŸ›  Fixed bug #2144 : Squiz.Arrays.ArrayDeclaration does incorrect align calculation in array with cyrillic keys
    • πŸ›  Fixed bug #2146 : Zend.Files.ClosingTag removes closing tag from end of file without inserting a semicolon
    • πŸ›  Fixed bug #2151 : XML schema not updated with the new array property syntax
  • v2.9.2 Changes

    November 07, 2018

    πŸš€ Final 2.9 Release

    πŸ”– Version 2.9.2 will be the final release of the PHP_CodeSniffer 2.9 branch, first released over 4 years ago. All developers still using version 2 are strongly encouraged to migrate to version 3.

    ⬆️ Version 3 was first released as stable on the 4th of May 2017 and is a large refactoring of the code base that breaks backwards compatibility for all custom sniffs and custom reports. An upgrade guide for sniff and report developers is available here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Version-3.0-Upgrade-Guide

    Note: If you only use the built-in coding standards (such as PEAR or PSR2), or you have a custom ruleset.xml file that only makes use of the sniffs and reports distributed with PHP_CodeSniffer, you do not need to make any changes to begin using PHP_CodeSniffer version 3.

    Other Changes

    • πŸ—„ PHPCS should now run under PHP 7.3 without deprecation warnings
      • Thanks to Nick Wilde for the patch
    • πŸ›  Fixed bug #1496 : Squiz.Strings.DoubleQuoteUsage not unescaping dollar sign when fixing
      • Thanks to MichaΕ‚ Bundyra for the patch
    • πŸ›  Fixed bug #1549 : Squiz.PHP.EmbeddedPhp fixer conflict with // comment before PHP close tag
      • Thanks to Juliette Reinders Folmer for the patch
    • πŸ›  Fixed bug #1890 : Incorrect Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose error between catch and finally statements