packagist phpcompatibility/php-compatibility 7.0
PHP 7.0 Sniffs

latest releases: dev-develop, dev-feature/readme-fix-more-broken-badges, dev-WIP/feature/207-509-582-removed-extension-recognition-precision...
9 years ago

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. 👏

Don't miss a new php-compatibility release

NewReleases is sending notifications on new releases.