Skip to content

Releases: PHPCompatibility/PHPCompatibility

7.0.8: PHP 7.0 Sniffs - update 2016-10-31 - Spooky !

31 Oct 20:18
Compare
Choose a tag to compare

PHP 7.0 Sniffs - update 2016-10-31 - Spooky !

See all related issues and PRs in the 7.0.8 milestone.

Added

  • 🌟 New ForbiddenNamesAsDeclared sniff: detection of the other reserved keywords which are reserved as of PHP 7.0 (or higher). #287. Fixes #115.
    These were previously sniffed for by the ForbiddenNames and ForbiddenNamesAsInvokedFunctions sniffs causing false positives as the rules for their reservation are different from the rules for "normal" reserved keywords.
  • ⭐ New inUseScope() utility method to the PHPCompatibility_Sniff class which handles PHPCS cross-version compatibility when determining the scope of a use statement. #271.
  • β˜” More unit tests for the ForbiddenNames sniff. #271.

Changed

  • πŸ“Œ Deprecated functionality should throw a warning. Removed or otherwise unavailable functionality should throw an error. This distinction was previously not consistently applied everywhere. #286
    This change affects the following sniffs:
    • DeprecatedPHP4StyleConstructors will now throw a warning instead of an error for deprecated PHP4 style class constructors.
    • ForbiddenCallTimePassByReference will now throw a warning if the testVersion is 5.3 and an error if the testVersion if 5.4 or higher.
    • MbstringReplaceEModifier will now throw a warning instead of an error for usage of the deprecated e modifier.
    • PregReplaceEModifier will now throw a warning if the testVersion is 5.5 or 5.6 and an error if the testVersion if 7.0 or higher. Fixes #290.
    • TernaryOperators will now throw an error when the testVersion < 5.3 and the middle part has been omitted.
    • ValidIntegers will now throw a warning when an invalid binary integer is detected.
  • ✏️ DeprecatedFunctions and DeprecatedIniDirectives sniffs: minor change in the sniff error message text. Use "removed" rather than the ominous "forbidden". #285
    Also updated relevant internal variable names and documentation to match.

Fixed

  • πŸ› ForbiddenNames sniff would throw false positives for use statements which changed the visibility of methods in traits. #271.
  • πŸ› ForbiddenNames sniff would not report reserved keywords when used in combination with use function or use const. #271.
  • πŸ› ForbiddenNames sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. #271.
  • πŸ”§ Composer config: prefer-stable should be a root element of the json file. Fixes #277.

Credits

Thanks go out to Juliette Reinders Folmer for her contributions to this version. πŸ‘

7.0.7: PHP 7.0 Sniffs - update 2016-10-20

20 Oct 13:34
Compare
Choose a tag to compare

PHP 7.0 Sniffs - update 2016-10-20

See all related issues and PRs in the 7.0.7 milestone.

Added

  • 🌟 New ForbiddenBreakContinueOutsideLoop sniff: verify that break/continue is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. #278. Fixes #275
  • 🌟 New NewConstVisibility sniff: detect visibility indicators for class and interface constants as introduced in PHP 7.1. #280. Fixes #249
  • 🌟 New NewHashAlgorithms sniff to check used hash algorithms against the PHP version in which they were introduced. #242
  • 🌟 New NewMultiCatch sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. #281. Fixes #251
  • 🌟 New NewNullableTypes sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. #282. Fixes #247
  • ⭐ DeprecatedIniDirectives sniff: recognize PHP 7.1 removed session ini directives. #256
  • ⭐ NewFunctions sniff: recognize new socket_export_stream() function as introduced in PHP 7.0.7. #264
  • ⭐ NewFunctions sniff: recognize new curl_...(), is_iterable(), pcntl_async_signals(), session_create_id(), session_gc() functions as introduced in PHP 7.1. #273
  • ⭐ NewFunctionParameters sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. #258
  • ⭐ NewIniDirectives sniff: recognize new session ini directives as introduced in PHP 7.1. #259
  • ⭐ NewScalarReturnTypeDeclarations sniff: recognize PHP 7.1 void return type hint. #250
  • ⭐ NewScalarTypeDeclarations sniff: recognize PHP 7.1 iterable type hint. #255
  • ⭐ Recognize the PHP 7.1 deprecated mcrypt functionality in the RemovedExtensions, DeprecatedFunctions and DeprecatedIniDirectives sniffs. #257

Changed

  • πŸ“Œ LongArrays sniff used to only throw warnings. It will now throw errors for PHP versions in which the long superglobals have been removed. #270
  • πŸ“Œ The NewIniDirectives sniff used to always throw an warning. Now it will throw an error when a new ini directive is used in combination with ini_set(). #246.
  • πŸ“Œ RemovedHashAlgorithms sniff: also recognize removed algorithms when used with the PHP 5.5+ hash_pbkdf2() function. #240
  • πŸ“Œ Properly recognize nullable type hints in the getMethodParameters() utility method. #282
  • ✏️ DeprecatedPHP4StyleConstructors sniff: minor error message text fix. #236
  • ✏️ NewIniDirectives sniff: improved precision for the introduction version numbers being reported. #246
  • ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #238, #244, #240, #276
  • β˜” Re-activate the unit tests for the NewScalarReturnTypeDeclarations sniff. #250

Fixed

  • πŸ› The DeprecatedPHP4StyleConstructors sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. #236
  • πŸ› LongArrays sniff would report false positives for class properties shadowing removed PHP superglobals. #270. Fixes #268.
  • πŸ› The NewClasses sniff would not report errors when the case of the class name used and "official" class name did not match. #237
  • πŸ› The NewIniDirectives sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. #246
  • πŸ› PregReplaceEModifier sniff would report false positives for compound regex parameters with different quote types. #266. Fixes #265.
  • πŸ› RemovedGlobalVariables sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. #245.
  • πŸ› The RemovedHashAlgorithms sniff would not report errors when the case of the hash function name used and "official" class name did not match. #240
  • πŸ› The ShortArray sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. #238

Credits

Thanks go out to Juliette Reinders Folmer for her contributions to this version. πŸ‘

7.0.6: PHP 7.0 Sniffs - update 2016-09-23

23 Sep 00:04
Compare
Choose a tag to compare

PHP 7.0 Sniffs - update 2016-09-23

See all related issues and PRs in the 7.0.6 milestone.

Added

  • ⭐ New stripQuotes() utility method in the PHPCompatibility_Sniff base class to strip quotes which surround text strings in a consistent manner. #224
  • πŸ“š Readme: Add PHP Version Support section. #225

Changed

  • πŸ“Œ The ForbiddenCallTimePassByReference sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. #203
  • πŸ“Œ The NewFunctionArrayDereferencing sniff will now also check method calls for array dereferencing, not just function calls. #229. Fixes #227.
  • ✏️ The NewExecutionDirectives sniff will now throw warnings instead of errors for invalid values encountered in execution directives. #223
  • ✏️ Minor miscellaneous fixes. #231
  • ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #219, #203
  • ♻️ Defer to upstream findImplementedInterfaceNames() utility method when it exists. #222
  • πŸ”§ Exclude the test files from analysis by Scrutinizer CI. #230

Removed

  • 🚫 Some redundant code. #232

Fixed

  • πŸ› The EmptyNonVariable sniff would throw false positives for variable variables and for array access with a (partially) variable array index. #212. Fixes #210.
  • πŸ› The NewFunctionArrayDereferencing sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. #228. Fixes #226.
  • πŸ› ParameterShadowSuperGlobals sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. #218. Fixes #214.
  • πŸ› The determineNamespace() utility method now accounts properly for namespaces within scoped declare() statements. #221
  • πŸ“š Readme: Logo alignment in the Credits section. #233

Credits

Thanks go out to Jason Stallings, Juliette Reinders Folmer and Mark Clements for their contributions to this version. πŸ‘

7.0.5: PHP 7.0 Sniffs - update 2016-09-08

08 Sep 21:44
Compare
Choose a tag to compare

PHP 7.0 Sniffs - update 2016-09-08

See all related issues and PRs in the 7.0.5 milestone.

Added

  • 🌟 New MbstringReplaceEModifier sniff to detect the use of the PHP 7.1 deprecated e modifier in Mbstring regex functions. #202
  • ⭐ The ForbiddenBreakContinueVariableArguments sniff will now also report on break 0/continue 0 which is not allowed since PHP 5.4. #209
  • ⭐ New getFunctionCallParameters(), getFunctionCallParameter() utility methods in the PHPCompatibility_Sniff base class. #170
  • ⭐ New tokenHasScope() utility method in the PHPCompatibility_Sniff base class. #189
  • β˜” Unit test for goto and callable detection and some other miscellanous extra unit tests for the NewKeywords sniff. #189
  • πŸ“š Readme: Information for sniff developers about running unit tests for other sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. #217

Changed

  • πŸ“Œ The ForbiddenNames sniff will now also check interface declarations for usage of reserved keywords. #200
  • πŸ“Œ PregReplaceEModifier sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. #201
  • βͺ The NewKeywords sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. #189
  • ✏️ PregReplaceEModifier sniff: minor improvement to the error message text. #201
  • ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #170, #188, #189, #199, #200, #201, #208
  • πŸ”§ The unit tests for the utility methods have been moved to their own subdirectory within Tests. #215
  • πŸ’š The sniffs are now also tested against PHP 7.1 for consistent results. #216

Removed

Fixed

  • πŸ› ConstantArraysUsingDefine sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #199
  • πŸ› The DeprecatedIniDirectives and NewIniDirectives sniffs could potentially trigger on the ini value instead of the ini directive name. #170
  • πŸ› ForbiddenNames sniff: Reserved keywords when used as the name of a constant declared using define() would always be reported independently of the testVersion set. #200
  • πŸ› PregReplaceEModifier sniff would not report errors when the function name used was not in lowercase. #201
  • πŸ› TernaryOperators sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #188
  • πŸ› The getFQClassNameFromNewToken() and getFQClassNameFromDoubleColonToken() utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. #206. Fixes #205.
  • πŸ› The getFunctionCallParameters() utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The getFunctionCallParameters() utility method also did not handle parameters passed as short arrays correctly. #213. Fixes #211.
  • β˜” Unit tests for the NewFunctionArrayDereferencing sniff were not being run due to a naming error. #208
  • πŸ“š Readme: Information about setting the testVersion from a custom ruleset was incorrect. #204
  • πŸ”§ Path to PHPCS in the unit tests breaking for non-Composer installs. #198

Credits

Thanks go out to Juliette Reinders Folmer and Yoshiaki Yoshida for their contributions to this version. πŸ‘

7.0.4: PHP 7.0 Sniffs - update 2016-08-20

20 Aug 21:01
Compare
Choose a tag to compare

See all related issues and PRs in the 7.0.4 milestone.

Added

  • 🌟 New EmptyNonVariable sniff: detection of empty being used on non-variables for PHP < 5.5. #187
  • 🌟 New NewMagicMethods sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the __toString() magic method in PHP 5.2. #176. Fixes #64.
  • 🌟 New RemovedAlternativePHPTags sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. #184, #193. Fixes #127.
  • ⭐ NonStaticMagicMethods sniff: detection of the __callStatic(), __sleep(), __toString() and __set_state() magic methods.
  • πŸ’š Lint all non-test case files for syntax errors during the build testing by Travis. #192

Changed

  • πŸ“Œ NonStaticMagicMethods sniff: will now also sniff traits for magic methods. #174
  • πŸ“Œ NonStaticMagicMethods sniff: will now also check for magic methods which should be declared as static. #174
  • ♻️ Various (minor) refactoring for improved performance and sniff accuracy. #178, #179, #174, #171
  • ♻️ The unit test suite now internally caches PHPCS run results in combination with a set testVersion to speed up the running of the unit tests. These are now ~3 x faster. #148
  • πŸ“š Readme: Minor clarification of the minimum requirements.
  • πŸ“š Readme: Advise to use the latest stable version of this repository.
  • πŸ”§ The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. #191.
  • πŸ”§ Improved coveralls configuration and compatibility. #194
  • πŸ’š The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. #196

Fixed

  • πŸ› The ForbiddenBreakContinueVariableArguments sniff would not report on break/continue with a closure as an argument. #171
  • πŸ› The ForbiddenNamesAsInvokedFunctions sniff would not report on reserved keywords which were not lowercase. #186
  • πŸ› The ForbiddenNamesAsInvokedFunctions sniff would not report on the goto and namespace keywords when run on PHP 5.2. #193
  • πŸ› NewAnonymousClasses sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #195.
  • πŸ› NewGroupUseDeclarations sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #190.
  • πŸ› The NonStaticMagicMethods sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. #174
  • πŸ”§ The unit tests would exit with 0 if PHPCS could not be found. #191
  • πŸ’š The PHPCompatibility library itself was not fully compatible with PHP 5.2. #193

Credits

Thanks go out to Juliette Reinders Folmer for her contributions to this version. πŸ‘

7.0.3: PHP 7.0 Sniffs - update 2016-08-18

17 Aug 23:42
Compare
Choose a tag to compare

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
  • :bug...
Read more

7.0.2: PHP 7.0 Sniffs - update 2016-08-03

02 Aug 23:38
Compare
Choose a tag to compare

Fixes + improvements on 7.0.1

See all related issues and PRs in the 7.0.2 milestone.

Added

  • ⭐ RemovedExtensions sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. #130. Fixes #123.
    To use this feature, add the functionWhitelist property in your custom ruleset. For more information, see the README.

Changed

  • ✏️ A number of sniffs contained public class properties. Within PHPCS, public properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to protected. #135
  • πŸ”§ Composer config: Stable packages are preferred over unstable/dev.
  • ✏️ Ruleset name. #134

Credits

Thanks go out to Juliette Reinders Folmer for her contributions to this version. πŸ‘

7.0.1: PHP 7.0 Sniffs - update 2016-08-02

02 Aug 23:08
Compare
Choose a tag to compare

All PHP 7.0 sniffs + fixes for sniffs for previous versions

See all related issues and PRs in the 7.0.1 milestone.

Changed

  • πŸ“Œ The DeprecatedIniDirectives sniff used to throw an error when a deprecated ini directive was used in combination with ini_get(). It will now throw a warning instead. #122 Fixes #119.
    Usage of deprecated ini directives in combination with ini_set() will still throw an error.
  • πŸ“Œ The PregReplaceEModifier sniff now also detects the e modifier when used with the preg_filter() function. While this is undocumented, the e modifier was supported by the preg_filter() function as well. #128
  • ✏️ The RemovedExtensions sniff contained superfluous deprecation information in the error message. #131

Removed

  • πŸ”§ Duplicate builds from the Travis CI build matrix. #132

Fixed

  • πŸ› The ForbiddenNames sniff did not allow for the PHP 5.6 use function ... and use const ... syntax. #126 Fixes #124.
  • πŸ› The NewClasses sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. new NewClass;. #121
  • πŸ› The PregReplaceEModifier sniff failed to detect the e modifier when using bracket delimiters for the regex other than the {} brackets. #128
  • πŸ’š Unit tests failing against PHPCS 2.6.1.

Credits

Thanks go out to Jason Stallings, Juliette Reinders Folmer and Ryan Neufeld for their contributions to this version. πŸ‘

PHP 7.0 Sniffs

26 Jul 07:29
Compare
Choose a tag to compare

See all related issues and PRs in the 7.0 milestone.

Added

  • ⚑ Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. --runtime-set testVersion 5.0-5.4 will now test your code for compatibility with PHP 5.0 up to PHP 5.4. #99
  • 🌟 New NewFunctionArrayDereferencing sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes #52.
  • 🌟 New ShortArray sniff to detect short array syntax as introduced in PHP 5.4. #97. Fixes #47.
  • 🌟 New TernaryOperators sniff to detect ternaries without the middle part (elvis operator) as introduced in PHP 5.3. #101, #103. Fixes #49.
  • 🌟 New ConstantArraysUsingDefine sniff to detect constants declared using define() being assigned an array value which was not allowed prior to PHP 7.0. #110
  • 🌟 New DeprecatedPHP4StyleConstructors sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. #109.
  • 🌟 New ForbiddenEmptyListAssignment sniff to detect empty list() assignments which have been removed in PHP 7.0. #110
  • 🌟 New ForbiddenFunctionParametersWithSameName sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. #110
  • 🌟 New ForbiddenGlobalVariableVariable sniff to detect variable variables being made global which is not allowed since PHP 7.0. #110
  • 🌟 New ForbiddenNegativeBitshift sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. #110
  • 🌟 New ForbiddenSwitchWithMultipleDefaultBlocks sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. #110
  • 🌟 New NewAnonymousClasses sniff to detect anonymous classes as introduced in PHP 7.0. #110
  • 🌟 New NewFunctionParameters sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+ before_needle parameter for the strstr() function. #110, #112. Fixes #27.
  • 🌟 New NewGroupUseDeclarations sniff to detect group use declarations as introduced in PHP 7.0. #110
  • 🌟 New NewScalarReturnTypeDeclarations sniff to detect scalar return type hints as introduced in PHP 7.0. #110
  • 🌟 New NewScalarTypeDeclarations sniff to detect scalar function parameter type hints as introduced in PHP 7.0. #110
  • 🌟 New RemovedFunctionParameters sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. #110
  • 🌟 New RemovedGlobalVariables sniff to detect the PHP 7.0 removed $HTTP_RAW_POST_DATA superglobal. #110
  • ⭐ DeprecatedFunctions sniff: detection of the PHP 5.4 deprecated OCI8 functions. #93
  • ⭐ ForbiddenNamesAsInvokedFunctions sniff: recognize PHP 5.5 finally as a reserved keywords when invoked as a function. #110
  • ⭐ NewKeywords sniff: detection of the use of the PHP 5.1+ __halt_compiler keyword. Fixes #50.
  • ⭐ NewKeywords sniff: detection of the PHP 5.3+ nowdoc syntax. Fixes #48.
  • ⭐ NewKeywords sniff: detection of the use of the const keyword outside of a class for PHP < 5.3. Fixes #50.
  • ⭐ DeprecatedFunctions sniff: recognize PHP 7.0 deprecated and removed functions. #110
  • ⭐ DeprecatedIniDirectives sniff: recognize PHP 7.0 removed ini directives. #110
  • ⭐ ForbiddenNamesAsInvokedFunctions sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. #110
  • ⭐ ForbiddenNames sniff: recognize new PHP 7.0 reserved keywords. #110
  • ⭐ NewFunctions sniff: recognize new functions as introduced in PHP 7.0. #110
  • ⭐ NewLanguageConstructs sniff: recognize new PHP 7.0 <=> "spaceship" and ?? null coalescing operators. #110
  • ⭐ RemovedExtensions sniff: recognize PHP 7.0 removed ereg, mssql, mysql and sybase_ct extensions. #110
  • β˜” Additional unit tests for the NewLanguageConstructs sniff. #110
  • πŸ“š Readme: New section containing information about the use of the testVersion config variable.
  • πŸ“š Readme: Sponsor credits.

Changed

  • πŸ“Œ The DeprecatedIniDirectives sniff used to always throw an warning. Now it will throw an error when a removed ini directive is used. #110.
  • πŸ“Œ The DeprecatedNewReference sniff will now throw an error when the testVersion includes PHP 7.0 or higher. #110
  • πŸ“Œ The ForbiddenNames sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. #108, #110.
  • πŸ“Œ The PregReplaceEModifier sniff will now throw an error when the testVersion includes PHP 7.0 or higher. #110
  • ✏️ NewKeywords sniff: clarified the error message text for the use keyword. Fixes #46.
  • ♻️ Minor refactor of the testVersion related utility functions. #98
  • πŸ”§ Add autoload to the composer.json file. #96 Fixes #67.
  • πŸ”§ Minor other updates to the composer.json file. #75
  • πŸ”§ Improved creation of the code coverage reports needed by coveralls via Travis.
  • πŸ’š The sniffs are now also tested against PHP 7.0 for consistent results.

Fixed

  • πŸ› The ForbiddenCallTimePassByReference sniff was throwing Undefined index notices when used in combination with PHPCS 2.2.0. #100. Fixes #42.
  • πŸ› The ForbiddenNamesAsInvokedFunctions sniff would incorrectly throw an error if the throw keyword was used with parenthesis. Fixes #118.
  • πŸ› The PregReplaceEModifier sniff incorrectly identified e's in the pattern as the e modifier when using {} bracket delimiters for the regex. #94
  • πŸ› The RemovedExtensions sniff was throwing an error instead of a warning for deprecated, but not (yet) removed extensions. Fixes #62.

Credits

Thanks go out to AlexMiroshnikov, Chris Abernethy, dgudgeon, djaenecke, Eugene Maslovich, Ken Guest, Koen Eelen, Komarov Alexey, Mark Clements and Remko van Bezooijen for their contributions to this version. πŸ‘

PHP 5.6 release

19 Sep 14:43
Compare
Choose a tag to compare

See all related issues and PRs in the 5.6 milestone.

Added

  • 🌟 New: NewLanguageConstructs sniff. The initial version of this sniff checks for the PHP 5.6 ** power operator and the **= power assignment operator. #87. Fixes #60.
  • 🌟 New: ParameterShadowSuperGlobals sniff which covers the PHP 5.4 change Parameter names that shadow super globals now cause a fatal error.`. #74
  • 🌟 New: PregReplaceEModifier sniff which detects usage of the e modifier in literal regular expressions used with preg_replace(). The e modifier will not (yet) be detected when the regex passed is a variable or constant. #81, #84. Fixes #71, #83.
  • ⭐ DeprecatedIniDirectives sniff: PHP 5.6 deprecated ini directives.
  • ⭐ NewKeywords sniff: detection of the goto keyword introduced in PHP 5.3 and the callable keyword introduced in PHP 5.4. #57
  • ♻️ PHPCompatibility_Sniff base class initially containing the supportsAbove() and supportsBelow() utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set testVersion. #77
  • πŸ“š Readme: Composer installation instructions. #32, #61
  • πŸ”§ .gitignore to ignore vendor and IDE related directories. #78
  • πŸ’š Code coverage checking via coveralls.

Changed

  • πŸ”€ The check for the \ namespace separator has been moved from the NewKeywords sniff to the NewLanguageConstructs sniff. #88
  • ✏️ DeprecatedIniDirectives sniff: minor change in the sniff error message text.
  • ✏️ DeprecatedFunctions sniff: minor change in the sniff error message text.
  • πŸ”§ Minor updates to the composer.json file. #31, 34, #70
  • πŸ”§ Tests: The unit tests can now be run without configuration.
  • πŸ”§ Tests: Skipped unit tests will now be annotated as such. #85
  • πŸ’š The sniffs are now also tested against PHP 5.6 for consistent results.
  • πŸ’š The sniffs are now also tested against PHPCS 2.0+.
  • πŸ’š The sniffs are now tested using the new container-based infrastructure in Travis CI. #37

Fixed

  • πŸ› The ForbiddenCallTimePassByReference sniff was throwing false positives when a bitwise and & was used in combination with class constants and class properties within function calls. #44. Fixes #39.
  • πŸ› The ForbiddenNamesAsInvokedFunctions sniff was throwing false positives in certain cases when a comment separated a try from the catch block. #29
  • πŸ› The ForbiddenNamesAsInvokedFunctions sniff was incorrectly reporting instanceof as being introduced in PHP 5.4 while it has been around since PHP 5.0. #80
  • βœ… Compatibility with PHPCS 2.0 - 2.3. #63, #65

Credits

Thanks go out to Daniel Janecke, Declan Kelly, Dominic, Jaap van Otterdijk, Marin Crnkovic, Mark Clements, Nick Pack, Oliver Klee, Rowan Collins and Sam Van der Borght for their contributions to this version. πŸ‘