Added
- 🌟 New
CaseSensitiveKeywords
sniff to detect use of non-lowercaseself
,static
andparent
keywords which could cause compatibility issues pre-PHP 5.5. #382 - 🌟 New
ConstantArraysUsingConst
sniff to detect constants defined using theconst
keyword being assigned an array value which was not supported prior to PHP 5.6. #397 - 🌟 New
ForbiddenClosureUseVariableNames
sniff to detect PHP 7.1 forbidden variable names in closure use statements. #386. Fixes #374 - 🌟 New
NewArrayStringDereferencing
sniff to detect array and string literal dereferencing as introduced in PHP 5.5. #388 - 🌟 New
NewHeredocInitialize
sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. #391. Fixes #51 - 🌟 New
NewMagicClassConstant
sniff to detect use of the magic::class
constant as introduced in PHP 5.5. #403. Fixes #364. - 🌟 New
NewUseConstFunction
sniff to detect use statements importing constants and functions as introduced in PHP 5.6. #401 - ⭐
DeprecatedFunctions
sniff: recognize PHP 7.2 deprecated GD functions. #392 - ⭐
DeprecatedIniDirectives
sniff: recognize PHP 7.2 deprecatedmbstring.func_overload
directive. #377 - ⭐
NewClasses
sniff: check for the PHP 5.1libXMLError
class. #412 - ⭐
NewClasses
sniff: recognize all native PHP Exception classes. #418 - ⭐
NewClosures
sniff: check for closures being declared as static and closures using$this
. Both of which was not supported pre-PHP 5.4. #389. Fixes #24. - ⭐
NewFunctionParameters
sniff: recognize newexclude_disabled
parameter for theget_defined_functions()
function as introduced in PHP 7.0.15. #375 - ⭐
NewFunctions
sniff: recognize new PHP 7.2 socket related functions. #376 - ⭐
NewInterfaces
sniff: check for some more PHP native interfaces. #411 - ⭐ New
isClassProperty()
,isClassConstant()
andvalidDirectScope()
utility methods to thePHPCompatibility_Sniff
class. #393, #391. - ⭐ New
getTypeHintsFromFunctionDeclaration()
utility method to thePHPCompatibility_Sniff
class. #414. - ☔ Unit tests against false positives for the
NewMagicMethods
sniff. #381 - ☔ More unit tests for the
getTestVersion()
utility method. #405, #430 - 💚 The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. #433
- 📚 Readme: information about setting
installed_paths
via a custom ruleset. #407 - 📚
Changelog.md
file containing a record of notable changes since the first tagged release. #421
Changed
- 📌 The
ForbiddenNamesAsDeclared
sniff will now emitwarning
s for soft reserved keywords. #406, #370. - 📌 The
ForbiddenNames
sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. #417 - 📌 The
InternalInterfaces
,NewClasses
,NewConstVisibility
,NewInterfaces
,NewMagicMethods
,NonStaticMagicMethods
andRemovedGlobalVariables
sniffs will now also sniff for and correctly report violations in combination with anonymous classes. #378, #383, #393, #394, #395, #396. Fixes #351 and #333. - 📌 The
NewClasses
andNewInterfaces
sniffs will now also report on new classes/interfaces when used as type hints. #414, #416. Fixes #352 - 📌 The
NewClasses
sniff will now also report on Exception classes when used in (multi-)catch
statements. #418. Fixes #373. - 📌 The
NewScalarTypeDeclarations
sniff will now report on new type hints even when the type hint is nullable. #379 - 🔀 The
NewNowdoc
sniff has been renamed toNewNowdocQuotedHeredoc
and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. #390 - ⏪ The
NewClasses
sniff will now also report anonymous classes whichextend
a new sniff when used in combination with PHPCS 2.4.0-2.8.0. #432. Fixes #334. - ✏️
NewFunctionParameter
sniff: version number precision for two parameters. #384, #428 - ☔ Skipping two unit tests for the
ForbiddenClosureUseVariable
sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. #408 - ☔ Skipping unit tests involving
trait
s in combination with PHP < 5.4 and PHPCS < 2.4.0 astrait
s are not recognized in those circumstances. #431 - ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #385, #387, #415, #423, #424
- ♻️ Minor simplification of the PHPUnit 6 compatibility layer and other test code. #426, #425
- General housekeeping. #398, #400
- 🔧 Minor tweaks to the Travis build script. #409
- 💚 The sniffs are now also tested against PHP nightly for consistent results. #380
Fixed
- 🔥 Using unbounded ranges in
testVersion
resulted in unreported errors when used with sniffs using thesupportsBelow()
method. This affected the results of approximately half the sniffs. #430 - 🐛 The
ForbiddenNames
sniff would throw false positives foruse
statements with thefinal
modifier in traits. #402. - 🐛 The
ForbiddenNames
sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. #413 - 🐛 The
ForbiddenNames
sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. #419 - 🐛 The
ForbiddenNames
sniff would not always correctly report on use statements importing constants or functions using reserved keywords. #420 - 🐛 The
NewKeywords
sniff would sometimes fail to report on theconst
keyword when used in a class, but not for a class constant. #424 - 💚 PHPCS has released version 3.0 and updated the
master
branch to reflect this. This was causing the builds to fail. #422
Credits
Thanks go out to Juliette Reinders Folmer and Mark Clements for their contributions to this version. 👏