Several updates for 7.1 (and some for 7.2)
See all related issues and PRs in the 7.1.2 milestone.
Added
- 🌟 New
VariableVariables
sniff to detect variables variables for which the behaviour has changed in PHP 7.0. #310 Fixes #309. - ⭐ The
NewReturnTypeDeclarations
sniff will now also sniff for non-scalar return type declarations, i.e.array
,callable
,self
or a class name. #323 - ⭐ The
NewLanguageConstructs
sniff will now also sniff for the null coalesce equal operator??=
. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. #340 - ⭐ New
getReturnTypeHintToken()
utility method to thePHPCompatibility_Sniff
class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. #323. - ⭐ New
stripVariables()
utility method to thePHPCompatibility_Sniff
class to strip variables from interpolated text strings. #341. - ☔ Additional unit tests covering previously uncovered code. #308
Changed
- 📌 The
MbstringReplaceEModifier
,PregReplaceEModifier
andNewExecutionDirectives
sniffs will now also correctly interpret double quoted text strings with interpolated variables. #341, #324. - 📌 The
NewNullableTypes
sniff will now also report on nullable (return) type hints when used with closures. #323 - 📌 The
NewReturnTypeDeclarations
sniff will now also report on return type hints when used with closures. #323 - 📌 Allow for anonymous classes in the
inClassScope()
utility method. #315 - 📌 The function call parameter related utility functions can now also be used to get the individual items from an array declaration. #300
- 🔀 The
NewScalarReturnTypeDeclarations
sniff has been renamed toNewReturnTypeDeclarations
. #323 - ⏪ The
ForbiddenNames
sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. #319 - ⏪ The
NewAnonymousClasses
sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. #325 - ⏪ The
NewGroupUseDeclarations
sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. #320 - ⏪ The
NewNullableTypes
sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. #323 - ⏪ The
NewReturnTypeDeclarations
sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. #323 - ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #317
- ♻️ Defer to upstream
hasCondition()
utility method where appropriate. #315 - ♻️ Minor refactoring of some unit test code. #304, #303, #318
- 🔧 All unit tests now have appropriate
@group
annotations allowing for quicker/easier testing of a select group of tests/sniffs. #305 - 🔧 All unit tests now have appropriate
@covers
annotations to improve code coverage reporting and remove bleed through of accidental coverage. #307 - 🔧 Minor tweaks to the travis script. #322
- 💚 The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. #322
Fixed
- 🐛 The
ConstantArraysUsingDefine
sniff would throw false positives if the value of thedefine()
was retrieved via a function call and an array parameter was passed. #327 - 🐛 The
ForbiddenCallTimePassByReference
sniff would throw false positives on assign by reference within function calls or conditions. #302 Fixes the last two cases reported in #68 - 🐛 The
ForbiddenGlobalVariableVariableSniff
sniff would only examine the first variable in aglobal ...
statement causing unreported issues if subsequent variables were variable variables. #316 - 🐛 The
NewKeywords
sniff would throw a false positive for theconst
keyword when encountered in an interface. #312 - 🐛 The
NewNullableTypes
sniff would not report on nullable return types for namespaced classnames used as a type hint. #323 - 🐛 The
PregReplaceEModifier
sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of thee
modifier when an array of regexes was passed. #300 - 🐛 The
PregReplaceEModifier
sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. #300 - ✅ Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). #313, #323, #326, #340
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. 👏