Skip to content

Releases: squizlabs/PHP_CodeSniffer

1.5.0RC4

26 Sep 00:24
Compare
Choose a tag to compare
1.5.0RC4 Pre-release
Pre-release
  • You can now restrict violations to individual sniff codes using the --sniffs command line argument
    • Previously, this only restricted violations to an entire sniff and not individual messages
    • If you have scripts calling PHP_CodeSniffer::process() or creating PHP_CodeSniffer_File objects, you must update your code
    • The array of restrictions passed to PHP_CodeSniffer::process() must now be an array of sniff codes instead of class names
    • The PHP_CodeSniffer_File::__construct() method now requires an array of restrictions to be passed
  • Doc generation is now working again
  • Progress information now shows the percentage complete at the end of each line
  • Added report type --report=junit to show the error list in a JUnit compatible format
    • Thanks to Oleg Lobach for the contribution
  • Added support for the PHP 5.4 callable type hint
  • Fixed problem where some file content could be ignored when checking STDIN
  • Version information is now printed when installed via composer or run from a Git clone (request #20050)
  • Added Squiz DisallowBooleanStatementSniff to ban boolean operators outside of control structure conditions
  • The CSS tokenizer is now more reliable when encountering 'list' and 'break' strings
  • Coding standard ignore comments can now appear instead doc blocks as well as inline comments
    • Thanks to Stuart Langley for the patch
  • Generic LineLengthSniff now ignores SVN URL and Head URL comments
    • Thanks to Karl DeBisschop for the patch
  • PEAR MultiLineConditionSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • PEAR MultiLineAssignmentSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • PEAR FunctionDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • Squiz SwitchDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • Squiz CSS IndentationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Hugo Fonseca for the patch
  • Squiz and MySource File and Function comment sniffs now allow all tags and don't require a particular licence
  • Squiz standard now allows lines to be 120 characters long before warning; up from 85
  • Squiz LowercaseStyleDefinitionSniff no longer throws errors for class names in nested style definitions
  • Squiz ClassFileNameSniff no longer throws errors when checking STDIN
  • Squiz CSS sniffs no longer generate errors for IE filters
  • Squiz CSS IndentationSniff no longer sees comments as blank lines
  • Squiz LogicalOperatorSpacingSniff now ignores whitespace at the end of a line
  • Squiz.Scope.MethodScope.Missing error message now mentions 'visibility' instead of 'scope modifier'
    • Thanks to Renat Akhmedyanov for the patch
  • Added support for the PSR2 multi-line arguments errata
  • The PSR2 standard no longer throws errors for additional spacing after a type hint
  • PSR UseDeclarationSniff no longer throws errors for USE statements inside TRAITs
  • Fixed cases where code was incorrectly assigned the T_GOTO_LABEL token when used in a complex CASE condition
  • Fixed bug #20026 : Check for multi-line arrays that should be single-line is slightly wrong
    • Adds new error message for single-line arrays that end with a comma
  • Fixed bug #20029 : ForbiddenFunction sniff incorrectly recognizes methods in USE clauses
  • Fixed bug #20043 : Mis-interpretation of Foo::class
  • Fixed bug #20044 : PSR1 camelCase check does not ignore leading underscores
  • Fixed bug #20045 : Errors about indentation for closures with multi-line 'use' in functions
  • Fixed bug #20051 : Undefined index: scope_opener / scope_closer
    • Thanks to Anthon Pang for the patch

1.4.7

26 Sep 00:23
Compare
Choose a tag to compare
  • Added report type --report=junit to show the error list in a JUnit compatible format
    • Thanks to Oleg Lobach for the contribution
  • Added support for the PHP 5.4 callable type hint
  • Fixed problem where some file content could be ignored when checking STDIN
  • Version information is now printed when installed via composer or run from a Git clone (request #20050)
  • The CSS tokenizer is now more reliable when encountering 'list' and 'break' strings
  • Coding standard ignore comments can now appear instead doc blocks as well as inline comments
    • Thanks to Stuart Langley for the patch
  • Generic LineLengthSniff now ignores SVN URL and Head URL comments
    • Thanks to Karl DeBisschop for the patch
  • PEAR MultiLineConditionSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • PEAR MultiLineAssignmentSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • PEAR FunctionDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • Squiz SwitchDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Szabolcs Sulik for the patch
  • Squiz CSS IndentationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
    • Thanks to Hugo Fonseca for the patch
  • Squiz and MySource File and Function comment sniffs now allow all tags and don't require a particular licence
  • Squiz LowercaseStyleDefinitionSniff no longer throws errors for class names in nested style definitions
  • Squiz ClassFileNameSniff no longer throws errors when checking STDIN
  • Squiz CSS sniffs no longer generate errors for IE filters
  • Squiz CSS IndentationSniff no longer sees comments as blank lines
  • Squiz LogicalOperatorSpacingSniff now ignores whitespace at the end of a line
  • Squiz.Scope.MethodScope.Missing error message now mentions 'visibility' instead of 'scope modifier'
    • Thanks to Renat Akhmedyanov for the patch
  • Added support for the PSR2 multi-line arguments errata
  • The PSR2 standard no longer throws errors for additional spacing after a type hint
  • PSR UseDeclarationSniff no longer throws errors for USE statements inside TRAITs
  • Fixed bug #20026 : Check for multi-line arrays that should be single-line is slightly wrong
    • Adds new error message for single-line arrays that end with a comma
  • Fixed bug #20029 : ForbiddenFunction sniff incorrectly recognizes methods in USE clauses
  • Fixed bug #20043 : Mis-interpretation of Foo::class
  • Fixed bug #20044 : PSR1 camelCase check does not ignore leading underscores
  • Fixed bug #20045 : Errors about indentation for closures with multi-line 'use' in functions

1.5.0RC3

25 Jul 04:35
Compare
Choose a tag to compare
1.5.0RC3 Pre-release
Pre-release
  • Added report type --report=json to show the error list and total counts for all checked files
    • Thanks to Jeffrey Fisher for the contribution
  • PHP_CodeSniffer::isCamelCaps now allows for acronyms at the start of a string if the strict flag is FALSE
    • acronyms are defined as at least 2 uppercase characters in a row
    • e.g., the following is now valid camel caps with strict set to FALSE: XMLParser
  • The PHP tokenizer now tokenizes goto labels as T_GOTO_LABEL instead of T_STRING followed by T_COLON
  • The JS tokenizer now has support for the T_THROW token
  • Symlinked directories inside CodeSniffer/Standards and in ruleset.xml files are now supported
    • Only available since PHP 5.2.11 and 5.3.1
    • Thanks to Maik Penz for the patch
  • The JS tokenizer now correctly identifies T_INLINE_ELSE tokens instead of leaving them as T_COLON
    • Thanks to Arnout Boks for the patch
  • Explaining a standard (phpcs -e) that uses namespaces now works correctly
  • Restricting a check to specific sniffs (phpcs --sniffs=...) now works correctly with namespaced sniffs
    • Thanks to Maik Penz for the patch
  • Docs added for the entire Generic standard, and many sniffs from other standards are now documented as well
    • Thanks to Spencer Rinehart for the contribution
  • Clearer error message for when the sniff class name does not match the directory structure
  • Generated HTML docs now correctly show the open PHP tag in code comparison blocks
  • Added Generic InlineHTMLSniff to ensure a file only contains PHP code
  • Added Squiz ShorthandSizeSniff to check that CSS sizes are using shorthand notation only when 1 or 2 values are used
  • Added Squiz ForbiddenStylesSniff to ban the use of some deprecated browser-specific styles
  • Added Squiz NamedColoursSniff to ban the use of colour names
  • PSR2 standard no longer enforces no whitespace between the closing parenthesis of a function call and the semicolon
  • PSR2 ClassDeclarationSniff now ignores empty classes when checking the end brace position
  • PSR2 SwitchDeclarationSniff no longer reports errors for empty lines between CASE statements
  • PEAR ObjectOperatorIndentSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the indent setting in a ruleset.xml file to change
    • Thanks to Andrey Mindubaev for the patch
  • Squiz FileExtensionSniff now supports traits
    • Thanks to Lucas Green for the patch
  • Squiz ArrayDeclarationSniff no longer reports errors for no comma at the end of a line that contains a function call
  • Squiz SwitchDeclarationSniff now supports T_CONTINUE and T_THROW as valid case/default breaking statements
  • Squiz CommentedOutCodeSniff is now better at ignoring commented out HTML, XML and regular expressions
  • Squiz DisallowComparisonAssignmentSniff no longer throws errors for the third expression in a FOR statement
  • Squiz ColourDefinitionSniff no longer throws errors for some CSS class names
  • Squiz ControlStructureSpacingSniff now supports all types of CASE/DEFAULT breaking statements
  • Generic CallTimePassByReferenceSniff now reports errors for functions called using a variable
    • Thanks to Maik Penz for the patch
  • Generic ConstructorNameSniff no longer throws a notice for abstract constructors inside abstract classes
    • Thanks to Spencer Rinehart for the patch
  • Squiz ComparisonOperatorUsageSniff now checks inside elseif statements
    • Thanks to Arnout Boks for the patch
  • Squiz OperatorSpacingSniff now reports errors for no spacing around inline then and else tokens
    • Thanks to Arnout Boks for the patch
  • Fixed bug #19811 : Comments not ignored in all cases in AbstractPatternSniff
    • Thanks to Erik Wiffin for the patch
  • Fixed bug #19892 : ELSE with no braces causes incorrect SWITCH break statement indentation error
  • Fixed bug #19897 : Indenting warnings in templates not consistent
  • Fixed bug #19908 : PEAR MultiLineCondition Does Not Apply elseif
  • Fixed bug #19930 : option --report-file generate an empty file
  • Fixed bug #19935 : notify-send reports do not vanish in gnome-shell
    • Thanks to Christian Weiske for the patch
  • Fixed bug #19944 : docblock squiz sniff "return void" trips over return in lambda function
  • Fixed bug #19953 : PSR2 - Spaces before interface name for abstract class
  • Fixed bug #19956 : phpcs warns for Type Hint missing Resource
  • Fixed bug #19957 : Does not understand trait method aliasing
  • Fixed bug #19968 : Permission denied on excluded directory
  • Fixed bug #19969 : Sniffs with namespace not recognized in reports
  • Fixed bug #19997 : Class names incorrectly detected as constants

1.4.6

25 Jul 04:03
Compare
Choose a tag to compare
  • Added report type --report=json to show the error list and total counts for all checked files
    • Thanks to Jeffrey Fisher for the contribution
  • The JS tokenizer now has support for the T_THROW token
  • Symlinked directories inside CodeSniffer/Standards and in ruleset.xml files are now supported
    • Only available since PHP 5.2.11 and 5.3.1
    • Thanks to Maik Penz for the patch
  • The JS tokenizer now correctly identifies T_INLINE_ELSE tokens instead of leaving them as T_COLON
    • Thanks to Arnout Boks for the patch
  • Explaining a standard (phpcs -e) that uses namespaces now works correctly
  • Restricting a check to specific sniffs (phpcs --sniffs=...) now works correctly with namespaced sniffs
    • Thanks to Maik Penz for the patch
  • Docs added for the entire Generic standard, and many sniffs from other standards are now documented as well
    • Thanks to Spencer Rinehart for the contribution
  • Clearer error message for when the sniff class name does not match the directory structure
  • Generated HTML docs now correctly show the open PHP tag in code comparison blocks
  • Added Generic InlineHTMLSniff to ensure a file only contains PHP code
  • Added Squiz ShorthandSizeSniff to check that CSS sizes are using shorthand notation only when 1 or 2 values are used
  • Added Squiz ForbiddenStylesSniff to ban the use of some deprecated browser-specific styles
  • Added Squiz NamedColoursSniff to ban the use of colour names
  • PSR2 standard no longer enforces no whitespace between the closing parenthesis of a function call and the semicolon
  • PSR2 ClassDeclarationSniff now ignores empty classes when checking the end brace position
  • PSR2 SwitchDeclarationSniff no longer reports errors for empty lines between CASE statements
  • PEAR ObjectOperatorIndentSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the indent setting in a ruleset.xml file to change
    • Thanks to Andrey Mindubaev for the patch
  • Squiz FileExtensionSniff now supports traits
    • Thanks to Lucas Green for the patch
  • Squiz ArrayDeclarationSniff no longer reports errors for no comma at the end of a line that contains a function call
  • Squiz SwitchDeclarationSniff now supports T_CONTINUE and T_THROW as valid case/default breaking statements
  • Squiz CommentedOutCodeSniff is now better at ignoring commented out HTML, XML and regular expressions
  • Squiz DisallowComparisonAssignmentSniff no longer throws errors for the third expression in a FOR statement
  • Squiz ColourDefinitionSniff no longer throws errors for some CSS class names
  • Squiz ControlStructureSpacingSniff now supports all types of CASE/DEFAULT breaking statements
  • Generic CallTimePassByReferenceSniff now reports errors for functions called using a variable
    • Thanks to Maik Penz for the patch
  • Generic ConstructorNameSniff no longer throws a notice for abstract constructors inside abstract classes
    • Thanks to Spencer Rinehart for the patch
  • Squiz ComparisonOperatorUsageSniff now checks inside elseif statements
    • Thanks to Arnout Boks for the patch
  • Squiz OperatorSpacingSniff now reports errors for no spacing around inline then and else tokens
    • Thanks to Arnout Boks for the patch
  • Fixed bug #19811 : Comments not ignored in all cases in AbstractPatternSniff
    • Thanks to Erik Wiffin for the patch
  • Fixed bug #19892 : ELSE with no braces causes incorrect SWITCH break statement indentation error
  • Fixed bug #19897 : Indenting warnings in templates not consistent
  • Fixed bug #19908 : PEAR MultiLineCondition Does Not Apply elseif
  • Fixed bug #19913 : Running phpcs in interactive mode causes warnings
    • Thanks to Harald Franndorfer for the patch
  • Fixed bug #19935 : notify-send reports do not vanish in gnome-shell
    • Thanks to Christian Weiske for the patch
  • Fixed bug #19944 : docblock squiz sniff "return void" trips over return in lambda function
  • Fixed bug #19953 : PSR2 - Spaces before interface name for abstract class
  • Fixed bug #19956 : phpcs warns for Type Hint missing Resource
  • Fixed bug #19957 : Does not understand trait method aliasing
  • Fixed bug #19968 : Permission denied on excluded directory
  • Fixed bug #19969 : Sniffs with namespace not recognized in reports
  • Fixed bug #19997 : Class names incorrectly detected as constants

1.5.0RC2

02 Jul 23:29
Compare
Choose a tag to compare
1.5.0RC2 Pre-release
Pre-release

Ruleset Processing

Ruleset processing now has much better support for relative paths and detection of directories of sniffs. This may mean that sniffs that were not previously being included in a standard are now included correctly. Please check your standards to see if any new sniffs are being included. The best way to do this is to use the -e command line argument. For example, phpcs --standard=mystandard.xml -e will print a list of sniffs that will be run over your code.

This version also includes the ability to exclude whole directories of sniffs inside a ruleset and the ability to pass multiple standards to PHP_CodeSniffer on the command line. For example, phpcs --standard=PEAR,Squiz,mystandard.xml /path/to/code will run 3 standards against your code.

Other Changes

  • Ruleset processing has been rewritten to be more predictable
    • Provides much better support for relative paths inside ruleset files
    • May mean that sniffs that were previously ignored are now being included when importing external rulesets
    • Ruleset processing output can be seen by using the -vv command line argument
    • Internal sniff registering functions have all changed, so please review custom scripts
  • You can now pass multiple coding standards on the command line, comma separated (request #19144)
    • Works with built-in or custom standards and rulesets, or a mix of both
  • You can now exclude directories or whole standards in a ruleset XML file (request #19731)
    • e.g., exclude "Generic.Commenting" or just "Generic"
    • You can also pass in a path to a directory instead, if you know it
  • Added Generic LowerCaseKeywordSniff to ensure all PHP keywords are defined in lowercase
    • The PSR2 and Squiz standards now use this sniff
  • Added Generic SAPIUsageSniff to ensure the PHP_SAPI constant is used instead of php_sapi_name() (request #19863)
  • Squiz FunctionSpacingSniff now has a setting to specify how many lines there should between functions (request #19843)
    • Default remains at 2
    • Override the "spacing" setting in a ruleset.xml file to change
  • Squiz LowercasePHPFunctionSniff no longer throws errors for the limited set of PHP keywords it was checking
    • Add a rule for Generic.PHP.LowerCaseKeyword to your ruleset to replicate this functionality
  • Added support for the PHP 5.4 T_CALLABLE token so it can be used in lower PHP versions
  • Generic EndFileNoNewlineSniff now supports checking of CSS and JS files
  • PSR2 SwitchDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the indent setting in a ruleset.xml file to change
    • Thanks to Asher Snyder for the patch
  • Generic ScopeIndentSniff now has a setting to specify a list of tokens that should be ignored
    • The first token on the line is checked and the whole line is ignored if the token is in the array
    • Thanks to Eloy Lafuente for the patch
  • Squiz LowercaseClassKeywordsSniff now checks for the TRAIT keyword
    • Thanks to Anthon Pang for the patch
  • If you create your own PHP_CodeSniffer object, PHPCS will no longer exit when an unknown argument is found
    • This allows you to create wrapper scripts for PHPCS more easily
  • PSR2 MethodDeclarationSniff no longer generates a notice for methods named "_"
    • Thanks to Bart S for the patch
  • Squiz BlockCommentSniff no longer reports that a blank line between a scope closer and block comment is invalid
  • Generic DuplicateClassNameSniff no longer reports an invalid error if multiple PHP open tags exist in a file
  • Generic DuplicateClassNameSniff no longer reports duplicate errors if multiple PHP open tags exist in a file
  • Fixed bug #19819 : Freeze with syntax error in use statement
  • Fixed bug #19820 : Wrong message level in Generic_Sniffs_CodeAnalysis_EmptyStatementSniff
  • Fixed bug #19859 : CodeSniffer::setIgnorePatterns API changed
  • Fixed bug #19871 : findExtendedClassName doesn't return FQCN on namespaced classes
  • Fixed bug #19879 : bitwise and operator interpreted as reference by value

1.4.5

02 Jul 23:31
Compare
Choose a tag to compare
  • Added Generic LowerCaseKeywordSniff to ensure all PHP keywords are defined in lowercase
    • The PSR2 and Squiz standards now use this sniff
  • Added Generic SAPIUsageSniff to ensure the PHP_SAPI constant is used instead of php_sapi_name() (request #19863)
  • Squiz FunctionSpacingSniff now has a setting to specify how many lines there should between functions (request #19843)
    • Default remains at 2
    • Override the "spacing" setting in a ruleset.xml file to change
  • Squiz LowercasePHPFunctionSniff no longer throws errors for the limited set of PHP keywords it was checking
    • Add a rule for Generic.PHP.LowerCaseKeyword to your ruleset to replicate this functionality
  • Added support for the PHP 5.4 T_CALLABLE token so it can be used in lower PHP versions
  • Generic EndFileNoNewlineSniff now supports checking of CSS and JS files
  • PSR2 SwitchDeclarationSniff now has a setting to specify how many spaces code should be indented
    • Default remains at 4; override the indent setting in a ruleset.xml file to change
    • Thanks to Asher Snyder for the patch
  • Generic ScopeIndentSniff now has a setting to specify a list of tokens that should be ignored
    • The first token on the line is checked and the whole line is ignored if the token is in the array
    • Thanks to Eloy Lafuente for the patch
  • Squiz LowercaseClassKeywordsSniff now checks for the TRAIT keyword
    • Thanks to Anthon Pang for the patch
  • If you create your own PHP_CodeSniffer object, PHPCS will no longer exit when an unknown argument is found
    • This allows you to create wrapper scripts for PHPCS more easily
  • PSR2 MethodDeclarationSniff no longer generates a notice for methods named "_"
    • Thanks to Bart S for the patch
  • Squiz BlockCommentSniff no longer reports that a blank line between a scope closer and block comment is invalid
  • Generic DuplicateClassNameSniff no longer reports an invalid error if multiple PHP open tags exist in a file
  • Generic DuplicateClassNameSniff no longer reports duplicate errors if multiple PHP open tags exist in a file
  • Fixed bug #19819 : Freeze with syntax error in use statement
  • Fixed bug #19820 : Wrong message level in Generic_Sniffs_CodeAnalysis_EmptyStatementSniff
  • Fixed bug #19859 : CodeSniffer::setIgnorePatterns API changed
  • Fixed bug #19871 : findExtendedClassName doesn't return FQCN on namespaced classes
  • Fixed bug #19879 : bitwise and operator interpreted as reference by value

1.5.0RC1

26 Sep 04:00
Compare
Choose a tag to compare
1.5.0RC1 Pre-release
Pre-release
  • Reports have been completely rewritten to consume far less memory
    • Each report is incrementally written to the file system during a run and then printed out when the run ends
    • There is no longer a need to keep the list of errors and warnings in memory during a run
  • Multi-file sniff support has been removed because they are too memory intensive
    • If you have a custom multi-file sniff, you can convert it into a standard sniff quite easily
    • See CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php for an example

1.4.4

26 Sep 04:00
Compare
Choose a tag to compare
  • Ignored lines no longer cause the summary report to show incorrect error and warning counts
    • Thanks to Bert Van Hauwaert for the patch
  • Added Generic CSSLintSniff to run CSSLint over a CSS file and report warnings
    • Set full command to run CSSLint using phpcs --config-set csslint_path /path/to/csslint
    • Thanks to Roman Levishchenko for the contribution
  • Added PSR2 ControlStructureSpacingSniff to ensure there are no spaces before and after parenthesis in control structures
    • Fixes bug #19732 : PSR2: some control structures errors not reported
  • Squiz commenting sniffs now support non-English characters when checking for capital letters
    • Thanks to Roman Levishchenko for the patch
  • Generic EndFileNewlineSniff now supports JS and CSS files
    • Thanks to Denis Ryabkov for the patch
  • PSR1 SideEffectsSniff no longer reports constant declarations as side effects
  • Notifysend report now supports notify-send versions before 0.7.3
    • Thanks to Ken Guest for the patch
  • PEAR and Squiz FunctionCommentSniffs no longer report errors for misaligned argument comments when they are blank
    • Thanks to Thomas Peterson for the patch
  • Squiz FunctionDeclarationArgumentSpacingSniff now works correctly for equalsSpacing values greater than 0
    • Thanks to Klaus Purer for the patch
  • Squiz SuperfluousWhitespaceSniff no longer throws errors for CSS files with no newline at the end
  • Squiz SuperfluousWhitespaceSniff now allows a single newline at the end of JS and CSS files
  • Fixed bug #19755 : Token of T_CLASS type has no scope_opener and scope_closer keys
  • Fixed bug #19759 : Squiz.PHP.NonExecutableCode fails for return function()...
  • Fixed bug #19763 : Use statements for traits not recognised correctly for PSR2 code style
  • Fixed bug #19764 : Instead of for traits throws uppercase constant name errors
  • Fixed bug #19772 : PSR2_Sniffs_Namespaces_UseDeclarationSniff does not properly recognize last use
  • Fixed bug #19775 : False positive in NonExecutableCode sniff when not using curly braces
  • Fixed bug #19782 : Invalid found size functions in loop when using object operator
  • Fixed bug #19799 : config folder is not created automatically
  • Fixed bug #19804 : JS Tokenizer wrong /**/ parsing

1.4.3

26 Sep 04:00
Compare
Choose a tag to compare
  • Added support for the PHP 5.5 T_FINALLY token to detect try/catch/finally statements
  • Added empty CodeSniffer.conf to enable config settings for Composer installs
  • Added Generic EndFileNoNewlineSniff to ensure there is no newline at the end of a file
  • Autoloader can now load PSR-0 compliant classes
    • Thanks to Maik Penz for the patch
  • Squiz NonExecutableCodeSniff no longer throws error for multi-line RETURNs inside CASE statements
    • Thanks to Marc Ypes for the patch
  • Squiz OperatorSpacingSniff no longer reports errors for negative numbers inside inline THEN statements
    • Thanks to Klaus Purer for the patch
  • Squiz OperatorSpacingSniff no longer reports errors for the assignment of operations involving negative numbers
  • Squiz SelfMemberReferenceSniff can no longer get into an infinite loop when checking a static call with a namespace
    • Thanks to Andy Grunwald for the patch
  • Fixed bug #19699 : Generic.Files.LineLength giving false positives when tab-width is used
  • Fixed bug #19726 : Wrong number of spaces expected after instanceof static
  • Fixed bug #19727 : PSR2: no error reported when using } elseif {

1.4.2

26 Sep 04:01
Compare
Choose a tag to compare
  • PHP_CodeSniffer can now be installed using Composer
    • Require squizlabs/php_codesniffer in your composer.json file
    • Thanks to Rob Bast, Stephen Rees-Carter, Stefano Kowalke and Ivan Habunek for help with this
  • Squiz BlockCommentSniff and InlineCommentSniff no longer report errors for trait block comments
  • Squiz SelfMemberReferenceSniff now supports namespaces
    • Thanks to Andy Grunwald for the patch
  • Squiz FileCommentSniff now uses tag names inside the error codes for many messages
    • This allows you to exclude specific missing, out of order etc., tags
  • Squiz SuperfluousWhitespaceSniff now has an option to ignore blank lines
    • This will stop errors being reported for lines that contain only whitespace
    • Set the ignoreBlankLines property to TRUE in your ruleset.xml file to enable this
  • PSR2 no longer reports errors for whitespace at the end of blank lines
  • Fixed gitblame report not working on Windows
    • Thanks to Rogerio Prado de Jesus
  • Fixed an incorrect error in Squiz OperatorSpacingSniff for default values inside a closure definition
  • Fixed bug #19691 : SubversionPropertiesSniff fails to find missing properties
    • Thanks to Kevin Winahradsky for the patch
  • Fixed bug #19692 : DisallowMultipleAssignments is triggered by a closure
  • Fixed bug #19693 : exclude-patterns no longer work on specific messages
  • Fixed bug #19694 : Squiz.PHP.LowercasePHPFunctions incorrectly matches return by ref functions