github PHPCompatibility/PHPCompatibility 7.0.3
7.0.3: PHP 7.0 Sniffs - update 2016-08-18

latest releases: 9.3.5, 9.3.4, 9.3.3...
7 years ago

Fixes + improvements on 7.0.2

See all related issues and PRs in the 7.0.3 milestone.

Added

  • 🌟 New InternalInterfaces sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. #144
  • 🌟 New LateStaticBinding sniff: detection of PHP 5.3 late static binding. #177
  • 🌟 New NewExecutionDirectives sniff: verify execution directives set with declare(). #169
  • 🌟 New NewInterfaces sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the Serializable interface. #144
  • 🌟 New RequiredOptionalFunctionParameters sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. #165
  • 🌟 New ValidIntegers sniff: 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.
  • DeprecatedExtensions sniff: detect removal of the ereg extension in PHP 7. #149
  • DeprecatedFunctions sniff: detection of the PHP 5.0.5 deprecated php_check_syntax() and PHP 5.4 deprecated mysqli_get_cache_stats() functions. #155.
  • DeprecatedFunctions sniff: detect deprecation of a number of the mysqli functions in PHP 5.3. #149
  • DeprecatedFunctions sniff: detect removal of the call_user_method(), ldap_sort(), ereg_*() and mysql_*() functions in PHP 7.0. #149
  • DeprecatedIniDirectives sniff: detection of a lot more deprecated/removed ini directives. #146
  • NewFunctionParameters sniff: detection of a lot more new function parameters. #164
  • NewFunctions sniff: detection of numerous extra new functions. #161
  • NewIniDirectives sniff: detection of a lot more new ini directives. #146
  • NewLanguageConstructs sniff: detection of the PHP 5.6 ellipsis ... construct. #175
  • NewScalarTypeDeclarations sniff: detection of PHP 5.1 array and PHP 5.4 callable type hints. #168
  • RemovedFunctionParameters sniff: 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.CamelCapsFunctionName sniff is re-used for this with some customization. #173
  • ⭐ New getFQClassNameFromNewToken(), getFQExtendedClassName(), getFQClassNameFromDoubleColonToken(), getFQName(), isNamespaced(), determineNamespace() and getDeclaredNamespaceName() utility methods in the PHPCompatibility_Sniff base class for namespace determination. #162
  • ♻️ New inClassScope() utility method in the PHPCompatibility_Sniff base class. #168
  • ♻️ New doesFunctionCallHaveParameters() and getFunctionCallParameterCount() utility methods in the PHPCompatibility_Sniff base class. #153
  • ☔ Unit test for __halt_compiler() detection by the NewKeywords sniff.
  • ☔ Unit tests for the NewFunctions sniff. #161
  • ☔ Unit tests for the ParameterShadowSuperGlobals sniff. #180
  • 🔧 Minimal config for Scrutinizer CI. #145.

Changed

  • 📌 The DeprecatedIniDirectives and the NewIniDirectives sniffs will now indicate an alternative ini directive in case the directive has been renamed. #146
  • 📌 The NewClasses sniff will now also report on new classes being extended by child classes. #140.
  • 📌 The NewClasses sniff will now also report on static use of new classes. #162.
  • 📌 The NewScalarTypeDeclarations sniff will now throw an error on use of type hints pre-PHP 5.0. #168
  • 📌 The NewScalarTypeDeclarations sniff will now verify type hints used against typical mistakes. #168
  • 📌 The ParameterShadowSuperGlobals sniff will now do a case-insensitive variable name compare. #180
  • 📌 The RemovedFunctionParameters sniff will now also report warnings on deprecation of function parameters. #163
  • 🔀 The check for JsonSerializable has been moved from the NewClasses sniff to the NewInterfaces sniff. #162
  • ⏪ The NewLanguageConstructs sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. #175
  • ✏️ NewFunctionParameters sniff: use correct name for the new parameter for the dirname() function. #164
  • ✏️ NewScalarTypeDeclarations sniff: minor change in the sniff error message text. #168
  • ✏️ RemovedFunctionParameters sniff: minor change in the sniff error message text. #163
  • ✏️ The ParameterShadowSuperGlobals sniff now extends the PHPCompatibility_Sniff class. #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 DeprecatedFunctions sniff was reporting an incorrect deprecation/removal version number for a few functions. #149
  • 🐛 The DeprecatedIniDirectives sniff 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 DeprecatedPHP4StyleConstructors sniff would cause false positives for methods with the same name as the class in namespaced classes. #167
  • 🐛 The ForbiddenEmptyListAssignment sniff did not report errors when there were only comments or parentheses between the list parentheses. #166
  • 🐛 The ForbiddenEmptyListAssignment sniff will no longer cause false positives during live coding. #166
  • 🐛 The NewClasses sniff would potentially misidentify namespaced classes as PHP native classes. #161
  • 🐛 The NewFunctions sniff would fail to identify called functions when the function call was not lowercase. #161
  • 🐛 The NewFunctions sniff would potentially misidentify namespaced userland functions as new functions. #161
  • 🐛 The NewIniDirectives sniff was reporting an incorrect introduction version number for a few ini directives. #146
  • 🐛 NewKeywords sniff: the use of the const keyword should only be reported when used outside of a class for PHP < 5.3. #147. Fixes #129.
  • 🐛 The RemovedExtensions sniff 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 NewFunctionParameters and RemovedFunctionParameters now use the new doesFunctionCallHaveParameters() and getFunctionCallParameterCount() 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 false if 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. 👏

Don't miss a new PHPCompatibility release

NewReleases is sending notifications on new releases.