Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Draft: PHP_CodeSniffer 3.5.0 changelog
- Squiz.Formatting.OperatorBracket.SpacingAfterMinus has been renamed to Squiz.Formatting.OperatorBracket.SpacingAfterSign
-- 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
- `Conditions::getCondition()` accepts both a single token type or an array of token types for the `$type` parameter, which has been renamed to `$types` to convey this. The parameter is also now optional.
Additionally, the new version of the method has an optional boolean `$reverse` parameter which allows to indicate whether to get the _first_ condition of a certain type or the _last_.
- `ObjectDeclarations::getClassProperties()` now has improved handling of class declaration code interlaced with comments and/or annotations
- `ObjectDeclarations::findExtendedClassName() and `ObjectDeclarations::findExtendedInterfaceNames()` will now return the class/interface names without interlaced comments or whitespace
- The `FunctionDeclarations::getParameters()`, `FunctionDeclarations::getProperties()`, `Variables::getMemberProperties()` and the `ObjectDeclarations::getClassProperties()` methods used to throw a `TokenizerException` when an incorrect token was passed. They will now throw a `RuntimeException`.
- The `Variables::$phpReservedVars` property now contains more PHP reserved variables
- `ConstructNames::getDeclarationName()` could previously inadvertently misidentify the name of a structure in the case of parse errors/live coding. This has now also been fixed.
- `ConstructNames::getDeclarationName()` will now also recognize and return clearly invalid names, so sniffs can throw alerts about those.
- New `Generic.Lists.DisallowShortListSyntax` sniff. Sister-sniff to the `Generic.Arrays.DisallowShortArraySyntax` sniffs to disallow the use of short lists. Includes fixer.
- New `Generic.Lists.DisallowLongListSyntax` sniff. Sister-sniff to the `Generic.Arrays.DisallowLongArraySyntax` and the `Generic.Lists.DisallowShortListSyntax` sniffs to disallow the use of long lists. Includes fixer.
- The `AbstractVariableSniff` now has stricter checking whether something is a member variable with less tolerance for parse errors
- The `AbstractArraySniff` now passes three additional bits of information - absolute start and end token position of the array item and the "raw" content of the array item - via the `$indices` parameter to the processSingleLineArray() and processMultiLineArray() methods
- Bug fix: The `AbstractArraySniff` will no longer examine short lists
- Generic.CodeAnalysis.UnusedFunctionParameter now has improved handling of anonymous and nested classes
- Bug fix: Squiz.PHP.DisallowComparisonAssignment will no longer throw false positives for parameter default values in closure declarations
- Bug fix: Squiz.PHP.DisallowComparisonAssignment will now take short arrays into account
- Bug fix: Squiz.PHP.DisallowComparisonAssignment now has improved handling of assignments consisting of function calls or long arrays when combined with a comparison operator
- Bug fix: PEAR.NamingConventions.ValidFunctionName will no longer throw errors for PHP native double underscore methods
- Bug fix: Squiz.Functions.GlobalFunctions will now also throw errors for conditional function declarations in the global namespace
- Bug fix: The Squiz.NamingConventions.ValidVariableName and Zend.NamingConventions.ValidVariableName sniffs will no longer throw false positives for certain PHP reserved variables not being in camelCase
- Bug fix: PSR2.Namespaces.UseDeclaration will no longer throw false positives for a trait use statement in an anonymous class
- Bug fix: Generic.Classes.DuplicateClassName could go into an endless loop when it encounters a particular parse error
- Bug fix: Generic.Classes.DuplicateClassName will no longer throw false positives due to recognizing namespace operators as namespace declarations
- Bug fix: Generic.Classes.DuplicateClassName now has improved support for namespace declarations interlaced with comments
- Bug fix: Generic.Classes.DuplicateClassName now correctly remembers the current namespace for files containing both classes as well as inline HTML
- Bug fix: PSR1.Classes.ClassDeclaration will now no longer get confused by namespace operators
- Bug fix: PSR1.Classes.ClassDeclaration now has improved determination of whether or not the class is declared in a valid namespace
- Bug fix: PSR1.Files.SideEffects will now no longer get confused by namespace operators
- Bug fix: PSR1.Files.SideEffects will no longer ignore the contents of scoped namespaces
- Bug fix: PSR1.Files.SideEffects will now ignore the contents of closures
- Bug fix: PSR2.Namespaces.NamespaceDeclaration will now no longer get confused by namespace operators
- Bug fix: PSR2.Namespaces.NamespaceDeclaration will no longer demand a blank line after the declaration if the declaration ends with a PHP close tag
- Bug fix: PSR2.Namespaces.NamespaceDeclaration will now correctly detect (and fix) a missing blank line when the namespace declaration is scoped
- Bug fix: PSR2.Namespaces.UseDeclaration will now no longer get confused by namespace operators
- Bug fix: Squiz.Classes.SelfMemberReference will now no longer get confused by namespace operators
- Bug fix: Squiz.Classes.SelfMemberReference will now correctly recognize namespace declarations if they end on a PHP close tag
- Bug fix: Squiz.Classes.SelfMemberReference will now only report on and fix absolute class references
- Bug fix: Squiz.Arrays.ArrayDeclaration will no longer examine short lists
- Bug fix: Generic.Arrays.DisallowShortArraySyntax will no longer throw errors nor try to auto-fix short lists
- Squiz.WhiteSpace.OperatorSpacing now has improved recognition of unary operators
- Squiz.Formatting.OperatorBracket now has improved recognition of unary operators
- Squiz.Formatting.OperatorBracket.SpacingAfterSign is now a fixable error
- Bug fix: Squiz.Classes.ValidClassName could go into an infinite loop when a parse error was encountered
- Bug fix: Squiz.Commenting.BlockComment would not check the capitalization of comments when each comment line started with a "*".
- Squiz.Commenting.BlockComment will now also check the capitalization of at the start of comments in list format.
- Generic.Commenting.DocComment will now also check the capitalization of at the start of a long description in list format.
- Enhancement: both the Squiz.Commenting.FunctionComment sniff as well as the Squiz.Commenting.VariableComment sniff have a new public property called "typeFormat" which can be used to indicate whether @var, @param and @return tags should use long or short type format, i.e. `int` vs `integer`.
Valid values: "long", "short". Default value is "long" to maintain backward-compatibility.
- Enhancement: both the Squiz.Commenting.FunctionComment sniff as well as the Squiz.Commenting.VariableComment sniff will now recognize a lot more commonly used parameter/variable/return types and will suggest/auto-fix with alternatives more often if these are inconsistently used
- Bug fix: the PEAR.Commenting.ClassComment, Squiz.Commenting.ClassComment, Squiz.Commenting.VariableComment, PEAR.Commenting.FunctionComment, Squiz.Commenting.FunctionComment, Squiz.Commenting.FunctionCommentThrowTag and the MySource.Commenting.FunctionComment sniff all received fixes which will prevent them from incorrectly identifying an "//end" comment for preceding code as the docblock they intend to examine.
- Bug fix: the PEAR.Commenting.FunctionComment, Squiz.Commenting.FunctionComment, Squiz.Commenting.FunctionCommentThrowTag and MySource.Commenting.FunctionComment sniffs will no longer confuse comments in the function declaration statement with the docblock.
- Fixed bug #2368: the MySource.Commenting.FunctionComment sniff now detects the function comment in a more reliable manner and will no longer throw notices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment