Fixes + improvements on 7.0.2
See all related issues and PRs in the 7.0.3 milestone.
Added
- 🌟 New
InternalInterfacessniff: detection of internal PHP interfaces being which should not be implemented by user land classes. #144 - 🌟 New
LateStaticBindingsniff: detection of PHP 5.3 late static binding. #177 - 🌟 New
NewExecutionDirectivessniff: verify execution directives set withdeclare(). #169 - 🌟 New
NewInterfacessniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements theSerializableinterface. #144 - 🌟 New
RequiredOptionalFunctionParameterssniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. #165 - 🌟 New
ValidIntegerssniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. #160. Fixes #55. - ⭐
DeprecatedExtensionssniff: detect removal of theeregextension in PHP 7. #149 - ⭐
DeprecatedFunctionssniff: detection of the PHP 5.0.5 deprecatedphp_check_syntax()and PHP 5.4 deprecatedmysqli_get_cache_stats()functions. #155. - ⭐
DeprecatedFunctionssniff: detect deprecation of a number of themysqlifunctions in PHP 5.3. #149 - ⭐
DeprecatedFunctionssniff: detect removal of thecall_user_method(),ldap_sort(),ereg_*()andmysql_*()functions in PHP 7.0. #149 - ⭐
DeprecatedIniDirectivessniff: detection of a lot more deprecated/removed ini directives. #146 - ⭐
NewFunctionParameterssniff: detection of a lot more new function parameters. #164 - ⭐
NewFunctionssniff: detection of numerous extra new functions. #161 - ⭐
NewIniDirectivessniff: detection of a lot more new ini directives. #146 - ⭐
NewLanguageConstructssniff: detection of the PHP 5.6 ellipsis...construct. #175 - ⭐
NewScalarTypeDeclarationssniff: detection of PHP 5.1arrayand PHP 5.4callabletype hints. #168 - ⭐
RemovedFunctionParameterssniff: detection of a few extra removed function parameters. #163 - ⭐ Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream
Generic.NamingConventions.CamelCapsFunctionNamesniff is re-used for this with some customization. #173 - ⭐ New
getFQClassNameFromNewToken(),getFQExtendedClassName(),getFQClassNameFromDoubleColonToken(),getFQName(),isNamespaced(),determineNamespace()andgetDeclaredNamespaceName()utility methods in thePHPCompatibility_Sniffbase class for namespace determination. #162 - ♻️ New
inClassScope()utility method in thePHPCompatibility_Sniffbase class. #168 - ♻️ New
doesFunctionCallHaveParameters()andgetFunctionCallParameterCount()utility methods in thePHPCompatibility_Sniffbase class. #153 - ☔ Unit test for
__halt_compiler()detection by theNewKeywordssniff. - ☔ Unit tests for the
NewFunctionssniff. #161 - ☔ Unit tests for the
ParameterShadowSuperGlobalssniff. #180 - 🔧 Minimal config for Scrutinizer CI. #145.
Changed
- 📌 The
DeprecatedIniDirectivesand theNewIniDirectivessniffs will now indicate an alternative ini directive in case the directive has been renamed. #146 - 📌 The
NewClassessniff will now also report on new classes being extended by child classes. #140. - 📌 The
NewClassessniff will now also report on static use of new classes. #162. - 📌 The
NewScalarTypeDeclarationssniff will now throw an error on use of type hints pre-PHP 5.0. #168 - 📌 The
NewScalarTypeDeclarationssniff will now verify type hints used against typical mistakes. #168 - 📌 The
ParameterShadowSuperGlobalssniff will now do a case-insensitive variable name compare. #180 - 📌 The
RemovedFunctionParameterssniff will now also reportwarnings on deprecation of function parameters. #163 - 🔀 The check for
JsonSerializablehas been moved from theNewClassessniff to theNewInterfacessniff. #162 - ⏪ The
NewLanguageConstructssniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. #175 - ✏️
NewFunctionParameterssniff: use correct name for the new parameter for thedirname()function. #164 - ✏️
NewScalarTypeDeclarationssniff: minor change in the sniff error message text. #168 - ✏️
RemovedFunctionParameterssniff: minor change in the sniff error message text. #163 - ✏️ The
ParameterShadowSuperGlobalssniff now extends thePHPCompatibility_Sniffclass. #180 - ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #181, #182, #166, #167, #172, #180, #146, #138
- ♻️ Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. #139, #149
Fixed
- 🐛 The
DeprecatedFunctionssniff was reporting an incorrect deprecation/removal version number for a few functions. #149 - 🐛 The
DeprecatedIniDirectivessniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. #146 - 🐛 The
DeprecatedPHP4StyleConstructorssniff would cause false positives for methods with the same name as the class in namespaced classes. #167 - 🐛 The
ForbiddenEmptyListAssignmentsniff did not report errors when there were only comments or parentheses between the list parentheses. #166 - 🐛 The
ForbiddenEmptyListAssignmentsniff will no longer cause false positives during live coding. #166 - 🐛 The
NewClassessniff would potentially misidentify namespaced classes as PHP native classes. #161 - 🐛 The
NewFunctionssniff would fail to identify called functions when the function call was not lowercase. #161 - 🐛 The
NewFunctionssniff would potentially misidentify namespaced userland functions as new functions. #161 - 🐛 The
NewIniDirectivessniff was reporting an incorrect introduction version number for a few ini directives. #146 - 🐛
NewKeywordssniff: the use of theconstkeyword should only be reported when used outside of a class for PHP < 5.3. #147. Fixes #129. - 🐛 The
RemovedExtensionssniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. #156 - 🐛 ♻️ The
NewFunctionParametersandRemovedFunctionParametersnow use the newdoesFunctionCallHaveParameters()andgetFunctionCallParameterCount()utility methods for improved accuracy in identifying function parameters. This fixes several false positives. #153 Fixes #120, #151, #152. - 🐛 A number of sniffs would return
falseif the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. #138 - 🔧 The unit tests would fail to run when used in combination with a PEAR install of PHPCS. #157.
- 💚 Unit tests failing against PHPCS 2.6.1. #158
The unit tests will still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context.
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. 👏