» Version | » Information |
---|---|
2023-02-22 stable |
|
2022-06-18 stable |
|
2022-06-13 stable |
|
2021-12-12 stable |
|
2021-10-11 stable |
|
2021-04-08 stable |
|
2020-10-23 stable |
|
2020-10-22 stable |
|
2020-08-10 stable |
|
2020-04-16 stable |
|
2020-01-30 stable |
|
2019-12-04 stable |
|
2019-10-28 stable |
|
2019-10-16 stable |
|
3.5.0 |
Easy InstallNot sure? Get more info. pear install PHP_CodeSniffer-3.5.0 Pyrus InstallTry PEAR2's installer, Pyrus. php pyrus.phar install pear/PHP_CodeSniffer-3.5.0 Release date: 2019-09-26 19:22 UTC Release state: stable Release uploaded by: squiz Changelog: - The included PSR12 standard is now complete and ready to use -- Check your code using PSR-12 by running PHPCS with --standard=PSR12 - Added support for PHP 7.4 typed properties -- The nullable operator is now tokenized as T_NULLABLE inside property types, as it is elsewhere -- To get the type of a member var, use the File::getMemberProperties() method, which now contains a "type" array index --- This contains the type of the member var, or a blank string if not specified --- If the type is nullable, the return type will contain the leading ? --- If a type is specified, the position of the first token in the type will be set in a "type_token" array index --- If a type is specified, the position of the last token in the type will be set in a "type_end_token" array index --- If the type is nullable, a "nullable_type" array index will also be set to TRUE --- If the type contains namespace information, it will be cleaned of whitespace and comments in the return value - The PSR1 standard now correctly bans alternate PHP tags -- Previously, it only banned short open tags and not the pre-7.0 alternate tags - Added support for only checking files that have been locally staged in a git repo -- Use --filter=gitstaged to check these files -- You still need to give PHPCS a list of files or directories in which to apply the filter -- Thanks to Juliette Reinders Folmer for the contribution - JSON reports now end with a newline character - The phpcs.xsd schema now validates phpcs-only and phpcbf-only attributes correctly -- Thanks to Juliette Reinders Folmer for the patch - The tokenizer now correctly identifies inline control structures in more cases - All helper methods inside the File class now throw RuntimeException instead of TokenizerException -- Some tokenizer methods were also throwing RuntimeExpection but now correctly throw TokenizerException -- Thanks to Juliette Reinders Folmer for the patch - The File::getMethodParameters() method now returns more information, and supports closure USE groups -- If a type hint is specified, the position of the last token in the hint will be set in a "type_hint_end_token" array index -- If a default is specified, the position of the first token in the default value will be set in a "default_token" array index -- If a default is specified, the position of the equals sign will be set in a "default_equal_token" array index -- If the param is not the last, the position of the comma will be set in a "comma_token" array index -- If the param is passed by reference, the position of the reference operator will be set in a "reference_token" array index -- If the param is variable length, the position of the variadic operator will be set in a "variadic_token" array index - The T_LIST token and it's opening and closing parentheses now contain references to each other in the tokens array -- Uses the same parenthesis_opener/closer/owner indexes as other tokens -- Thanks to Juliette Reinders Folmer for the patch - The T_ANON_CLASS token and it's opening and closing parentheses now contain references to each other in the tokens array -- Uses the same parenthesis_opener/closer/owner indexes as other tokens -- Only applicable if the anon class is passing arguments to the constructor -- Thanks to Juliette Reinders Folmer for the patch - The PHP 7.4 T_BAD_CHARACTER token has been made available for older versions -- Allows you to safely look for this token, but it will not appear unless checking with PHP 7.4+ - Metrics are now available for Squiz.WhiteSpace.FunctionSpacing -- Use the "info" report to see blank lines before/after functions -- Thanks to Juliette Reinders Folmer for the patch - Metrics are now available for Squiz.WhiteSpace.MemberVarSpacing -- Use the "info" report to see blank lines before member vars -- Thanks to Juliette Reinders Folmer for the patch - Added Generic.ControlStructures.DisallowYodaConditions sniff -- Ban the use of Yoda conditions -- Thanks to Mponos George for the contribution - Added Generic.PHP.RequireStrictTypes sniff -- Enforce the use of a strict types declaration in PHP files - Added Generic.WhiteSpace.SpreadOperatorSpacingAfter sniff -- Checks whitespace between the spread operator and the variable/function call it applies to -- Thanks to Juliette Reinders Folmer for the contribution - Added PSR12.Classes.AnonClassDeclaration sniff -- Enforces the formatting of anonymous classes - Added PSR12.Classes.ClosingBrace sniff -- Enforces that closing braces of classes/interfaces/traits/functions are not followed by a comment or statement - Added PSR12.ControlStructures.BooleanOperatorPlacement sniff -- Enforces that boolean operators between conditions are consistently at the start or end of the line - Added PSR12.ControlStructures.ControlStructureSpacing sniff -- Enforces that spacing and indents are correct inside control structure parenthesis - Added PSR12.Files.DeclareStatement sniff -- Enforces the formatting of declare statements within a file - Added PSR12.Files.FileHeader sniff -- Enforces the order and formatting of file header blocks - Added PSR12.Files.ImportStatement sniff -- Enforces the formatting of import statements within a file - Added PSR12.Files.OpenTag sniff -- Enforces that the open tag is on a line by itself when used at the start of a php-only file - Added PSR12.Functions.ReturnTypeDeclaration sniff -- Enforces the formatting of return type declarations in functions and closures - Added PSR12.Properties.ConstantVisibility sniff -- Enforces that constants must have their visibility defined -- Uses a warning instead of an error due to this conditionally requiring the project to support PHP 7.1+ - Added PSR12.Traits.UseDeclaration sniff -- Enforces the formatting of trait import statements within a class - Generic.Files.LineLength ignoreComments property now ignores comments at the end of a line -- Previously, this property was incorrectly causing the sniff to ignore any line that ended with a comment -- Now, the trailing comment is not included in the line length, but the rest of the line is still checked - Generic.Files.LineLength now only ignores unwrappable comments when the comment is on a line by itself -- Previously, a short unwrappable comment at the end of the line would have the sniff ignore the entire line - Generic.Functions.FunctionCallArgumentSpacing no longer checks spacing around assignment operators inside function calls -- Use the Squiz.WhiteSpace.OperatorSpacing sniff to enforce spacing around assignment operators --- Note that this sniff checks spacing around all assignment operators, not just inside function calls -- The Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals error has been removed --- use Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore instead -- The Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterEquals error has been removed --- use Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter instead -- This also changes the PEAR/PSR2/PSR12 standards so they no longer check assignment operators inside function calls --- They were previously checking these operators when they should not have -- Thanks to Juliette Reinders Folmer for the patch - Generic.WhiteSpace.ScopeIndent no longer performs exact indents checking for chained method calls -- Other sniffs can be used to enforce chained method call indent rules -- Thanks to Pieter Frenssen for the patch - PEAR.WhiteSpace.ObjectOperatorIndent now supports multi-level chained statements -- When enabled, chained calls must be indented 1 level more or less than the previous line -- Set the new "multilevel" setting to TRUE in a ruleset.xml file to enable this behaviour -- Thanks to Marcos Passos for the patch - PSR2.ControlStructures.ControlStructureSpacing now allows whitespace after the opening parenthesis if followed by a comment -- Thanks to Micha? Bundyra for the patch - PSR2.Classes.PropertyDeclaration now enforces a single space after a property type keyword -- The PSR2 standard itself excludes this new check as it is not defined in the written standard -- Using the PSR12 standard will enforce this check - Squiz.Commenting.BlockComment no longer requires blank line before comment if it's the first content after the PHP open tag -- Thanks to Juliette Reinders Folmer for the patch - Squiz.Functions.FunctionDeclarationArgumentSpacing now has more accurate error messages -- This includes renaming the SpaceAfterDefault error code to SpaceAfterEquals, which reflects the real error - Squiz.Functions.FunctionDeclarationArgumentSpacing now checks for no space after a reference operator -- If you don't want this new behaviour, exclude the SpacingAfterReference error message in a ruleset.xml file - Squiz.Functions.FunctionDeclarationArgumentSpacing now checks for no space after a variadic operator -- If you don't want this new behaviour, exclude the SpacingAfterVariadic error message in a ruleset.xml file - Squiz.Functions.MultiLineFunctionDeclaration now has improved fixing for the FirstParamSpacing and UseFirstParamSpacing errors - Squiz.Operators.IncrementDecrementUsage now suggests pre-increment of variables instead of post-increment -- This change does not enforce pre-increment over post-increment; only the suggestion has changed -- Thanks to Juliette Reinders Folmer for the patch - Squiz.PHP.DisallowMultipleAssignments now has a second error code for when assignments are found inside control structure conditions -- The new error code is Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure -- All other multiple assignment cases use the existing error code Squiz.PHP.DisallowMultipleAssignments.Found -- Thanks to Juliette Reinders Folmer for the patch - Squiz.WhiteSpace.FunctionSpacing now applies beforeFirst and afterLast spacing rules to nested functions -- Previously, these rules only applied to the first and last function in a class, interface, or trait -- These rules now apply to functions nested in any statement block, including other functions and conditions - Squiz.WhiteSpace.OperatorSpacing now has improved handling of parse errors -- Thanks to Juliette Reinders Folmer for the patch - Squiz.WhiteSpace.OperatorSpacing now checks spacing around the instanceof operator -- Thanks to Jakub Chábek for the patch - Squiz.WhiteSpace.OperatorSpacing can now enforce a single space before assignment operators -- Previously, the sniff this spacing as multiple assignment operators are sometimes aligned -- Now, you can set the ignoreSpacingBeforeAssignments sniff property to FALSE to enable checking -- Default remains TRUE, so spacing before assignments is not checked by default -- Thanks to Jakub Chábek for the patch - Fixed bug #2391 : Sniff-specific ignore rules inside rulesets are filtering out too many files -- Thanks to Juliette Reinders Folmer and Willington Vega for the patch - Fixed bug #2478 : FunctionCommentThrowTag.WrongNumber when exception is thrown once but built conditionally - Fixed bug #2479 : Generic.WhiteSpace.ScopeIndent error when using array destructing with exact indent checking - Fixed bug #2498 : Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed autofix breaks heredoc - Fixed bug #2502 : Generic.WhiteSpace.ScopeIndent false positives with nested switch indentation and case fall-through - Fixed bug #2504 : Generic.WhiteSpace.ScopeIndent false positives with nested arrays and nowdoc string - Fixed bug #2511 : PSR2 standard not checking if closing paren of single-line function declaration is on new line - Fixed bug #2512 : Squiz.PHP.NonExecutableCode does not support alternate SWITCH control structure -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2522 : Text generator throws error when code sample line is too long -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2526 : XML report format has bad syntax on Windows -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2529 : Generic.Formatting.MultipleStatementAlignment wrong error for assign in string concat - Fixed bug #2534 : Unresolvable installed_paths can lead to open_basedir errors -- Thanks to Oliver Nowak for the patch - Fixed bug #2541 : Text doc generator does not allow for multi-line rule explanations -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2549 : Searching for a phpcs.xml file can throw warnings due to open_basedir restrictions -- Thanks to Matthew Peveler for the patch - Fixed bug #2558 : PHP 7.4 throwing offset syntax with curly braces is deprecated message -- Thanks to Matthew Peveler for the patch - Fixed bug #2561 : PHP 7.4 compatibility fix / implode argument order -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2562 : Inline WHILE triggers SpaceBeforeSemicolon incorrectly -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2565 : Generic.ControlStructures.InlineControlStructure confused by mixed short/long tags -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2566 : Author tag email validation doesn't support all TLDs -- Thanks to Juliette Reinders Folmer for the patch - Fixed bug #2575 : Custom error messages don't have data replaced when cache is enabled - Fixed bug #2601 : Squiz.WhiteSpace.FunctionSpacing incorrect fix when spacing is 0 - Fixed bug #2608 : PSR2 throws errors for use statements when multiple namespaces are defined in a file Dependencies:
|
2019-04-10 stable |
|
2019-03-18 stable |
|
2018-12-19 stable |
|
2018-09-23 stable |
|
2018-07-26 stable |
|
2018-06-06 stable |
|
2018-02-20 stable |
|
2017-12-19 stable |
|
2017-12-17 stable |
|
2017-12-12 stable |
|
2017-10-16 stable |
|
2017-09-19 stable |
|
2017-07-17 stable |
|
2017-06-13 stable |
|
2017-05-21 stable |
|
2017-05-03 stable |
|
2017-05-03 stable |
|
2017-03-01 beta |
|
2017-03-01 stable |
|
2017-02-01 beta |
|
2017-02-01 stable |
|
2016-11-29 beta |
|
2016-11-29 stable |
|
2016-09-01 beta |
|
2016-09-01 stable |
|
2016-07-19 alpha |
|
2016-07-13 stable |
|
2016-05-30 stable |
|
2016-04-03 stable |
|
2016-01-19 stable |
|
2015-12-10 stable |
|
2015-11-23 stable |
|
2015-09-09 stable |
|
2015-06-24 stable |
|
2015-04-29 stable |
|
2015-04-23 stable |
|
2015-03-04 stable |
|
2015-01-22 stable |
|
2014-12-18 stable |
|
2014-12-05 stable |
|
2014-12-04 stable |
|
2014-11-06 beta |
|
2014-10-16 beta |
|
2014-09-26 beta |
|
2014-09-26 stable |
|
2014-08-06 beta |
|
2014-08-06 stable |
|
2014-05-01 alpha |
|
2014-05-01 stable |
|
2014-02-05 alpha |
|
2014-02-05 stable |
|
2013-12-12 stable |
|
2013-11-27 stable |
|
2013-11-25 stable |
|
2013-09-26 beta |
|
2013-09-26 stable |
|
2013-07-25 beta |
|
2013-07-25 stable |
|
2013-04-04 beta |
|
2013-04-04 stable |
|
2013-02-08 beta |
|
2013-02-06 stable |
|
2012-12-04 stable |
|
2012-11-09 stable |
|
2012-11-01 stable |
|
2012-09-26 stable |
|
2012-08-08 stable |
|
2012-07-12 stable |
|
2012-05-17 stable |
|
2012-02-17 stable |
|
2011-12-01 stable |
|
2011-11-03 stable |
|
2011-03-17 stable |
|
2011-01-14 beta |
|
2010-09-03 beta |
|
2010-07-15 alpha |
|
2010-01-27 stable |
|
2009-11-17 stable |
|
2009-08-17 stable |
|
2009-07-07 beta |
|
2009-05-25 beta |
|
2009-03-09 beta |
|
2008-12-18 alpha |
|
2008-07-14 stable |
|
2008-07-03 beta |
|
2008-06-13 beta |
|
2008-05-12 beta |
|
2008-04-20 alpha |
|
2008-02-03 stable |
|
2007-12-20 stable |
|
2007-11-29 beta |
|
2007-11-13 beta |
|
2007-10-31 beta |
|
2007-09-24 beta |
|
2007-08-08 beta |
|
2007-07-01 beta |
|
2007-05-14 beta |
|
2007-04-16 beta |
|
2007-02-18 beta |
|
2007-01-11 beta |
|
2006-10-12 alpha |
|
2006-09-25 alpha |
|
2006-09-18 alpha |
|
2006-09-18 alpha |