Skip to content

PHPCompatibility 9.3.0

Compare
Choose a tag to compare
@jrfnl jrfnl released this 28 Aug 15:31
· 108 commits to master since this release
06cc8d2

See all related issues and PRs in the 9.3.0 milestone.

To keep informed of the progress of covering "everything PHP 7.4" in PHPCompatibility, please subscribe to issue #808.

Changes expected in PHPCompatibility 10.0.0

The next version of PHPCompatibility is expected to include a new external dependency.

In this same release, support for PHP < 5.4 and PHP_CodeSniffer < 2.6.0 will be dropped.

The 10.0.0 release is expected around the same time as the release of PHP 7.4 - end of November/beginning of December 2019.

Added

  • 🌟 New PHPCompatibility.Miscellaneous.NewPHPOpenTagEOF sniff to detect a stand-alone PHP open tag at the end of a file, without trailing newline, as will be supported as of PHP 7.4. #843
  • 🌟 New PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML sniff to detect calls to strip_tags() passing self-closing XHTML tags in the $allowable_tags parameter. This has not been supported since PHP 5.3.4. #866
  • 🌟 New PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault sniff to detect calls to html_entity_decode(), htmlentities() and htmlspecialchars() which are impacted by the change to the default value of the $encoding parameter in PHP 5.4. #862
  • 🌟 New PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault sniff to detect code impacted by the change in the default_charset value in PHP 5.6. #864 Fixes #839
  • 🌟 New PHPCompatibility.ParameterValues.NewIDNVariantDefault sniff to detect calls to idn_to_ascii() and idn_to_utf8() impacted by the PHP 7.4 change in the default value for the $variant parameter. #861
  • 🌟 New PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues sniff to detect calls to password_hash() and password_needs_rehash() impacted by the changed value of the PASSWORD_DEFAULT, PASSWORD_BCRYPT, PASSWORD_ARGON2I and PASSWORD_ARGON2ID constants in PHP 7.4. #865
  • 🌟 New PHPCompatibility.ParameterValues.NewProcOpenCmdArray sniff to detect calls to proc_open() passing an array for the $cmd parameter as supported as of PHP 7.4. #869
  • 🌟 New PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray sniff to detect calls to strip_tags() passing an array for the $allowable_tags parameter as will be supported as of PHP 7.4. #867
  • 🌟 New PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder sniff to detect implode() being called with $glue and $pieces in reverse order from the documented argument order. This was previously allowed for historical reasons, but will be deprecated in PHP 7.4. #846
  • 🌟 New PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam sniff to detect the $encoding being passed as the third, instead of the fourth parameter, to mb_strrpos() as has been soft deprecated since PHP 5.2 and will be hard deprecated as of PHP 7.4. #860
  • 🌟 New PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess sniff to detect array and string offset access using curly braces as will be deprecated as of PHP 7.4. #855
    • In contrast to any other sniff in the PHPCompatibility standard, this sniff contains an auto-fixer.
  • 🌟 New PHPCompatibility.TextStrings.NewUnicodeEscapeSequence sniff to detect use of the PHP 7.0+ unicode codepoint escape sequences and issues with invalid sequences. #856
  • 🌟 New PHPCompatibility.Upgrade.LowPHP sniff to give users of old PHP versions advance warning when support will be dropped in the near future. #838
    At this moment, the intention is to drop support for PHP 5.3 by the end of this year.
  • PHPCompatibility.Classes.NewClasses sniff: recognize the new WeakReference class as introduced in PHP 7.4. #857
  • PHPCompatibility.Constants.NewConstants sniff: detection of new Curl constants as introduced in PHP 7.3.5. #878
  • PHPCompatibility.Constants.NewConstants sniff: detection of the revived T_BAD_CHARACTER constant as re-introduced in PHP 7.4. #882
  • PHPCompatibility.Constants.NewConstants sniff: detection of the new IMG_FILTER_SCATTER and PASSWORD_ARGON2_PROVIDER constants as introduced in PHP 7.4. #887
  • PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the CURLPIPE_HTTP1 constant which will be deprecated in PHP 7.4. #879
  • PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the FILTER_SANITIZE_MAGIC_QUOTES constant which will be deprecated in PHP 7.4. #845
  • PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the T_CHARACTER and T_BAD_CHARACTER constants which were removed in PHP 7.0. #882
  • PHPCompatibility.FunctionDeclarations.NewMagicMethods sniff: recognize the new __serialize() and __unserialize() magic methods as introduced in PHP 7.4. #868
  • PHPCompatibility.FunctionDeclarations.NewMagicMethods sniff: recognize the PHP 5.0 __construct() and __destruct() magic methods. #884
  • PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods sniff: recognize the new __serialize() and __unserialize() magic methods as introduced in PHP 7.4. #868
  • PHPCompatibility.FunctionUse.NewFunctions sniff: recognize the new PHP 7.4 function imagecreatefromtga(). #873
  • PHPCompatibility.FunctionUse.RemovedFunctionParameters sniff: recognize the deprecation of the $age parameter of the curl_version() function. #874
  • PHPCompatibility.FunctionUse.RemovedFunctions sniff: recognize the PHP 7.4 deprecated convert_cyr_string()(), ezmlm_hash(), get_magic_quotes_gpc(), get_magic_quotes_runtime(), hebrevc(), is_real(), money_format() and restore_include_path() functions. #847
  • PHPCompatibility.IniDirectives.NewIniDirectives sniff: detect use of the new PHP 7.4 zend.exception_ignore_args ini directive. #871
  • PHPCompatibility.IniDirectives.RemovedIniDirectives sniff: detect use of the allow_url_include ini directive which is deprecated as of PHP 7.4. #870
  • PHPCompatibility.IniDirectives.RemovedIniDirectives sniff: detection of use of the opcache.load_comments directive which was removed in PHP 7.0. #883
  • PHPCompatibility.ParameterValues.NewHashAlgorithms: recognize use of the new PHP 7.4 crc32c hash algorithm. #872
  • PHPCompatibility.TypeCasts.RemovedTypeCasts sniff: detect usage of the (real) type cast which will be deprecated in PHP 7.4. #844
  • ⭐ Recognize the recode extension functionality which will be removed in PHP 7.4 (moved to PECL) in the RemovedExtensions and RemovedFunctions sniffs. #841
  • ⭐ Recognize the OPcache extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in the NewFunctions and NewIniDirectives sniffs. #883
  • ⭐ New getCompleteTextString() utility method to the PHPCompatibility\Sniff class. #856
  • ☔ Unit test for the PHPCompatibility.Upgrade.LowPHPCS sniff.
  • ☔ Some extra unit tests for the PHPCompatibility.ParameterValues.NewNegativeStringOffset, PHPCompatibility.ParameterValues.RemovedMbStringModifiers and sniffs. #876, #877
  • 📚 CONTRIBUTING.md: Added a list of typical sources for information about changes to PHP. #875

Changed

  • 📌 PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: the sniff will now also examine the function docblock, if available, and will throw an error when a @throws tag is found in the docblock. #880. Fixes #863
  • 📌 PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods sniff: will now also check the visibility and static (or not) requirements of the magic __construct(), __destruct(), __clone(), __debugInfo(), __invoke() and __set_state() methods. #885
  • 📌 PHPCompatibility.Syntax.NewArrayStringDereferencing sniff: the sniff will now also recognize array string dereferencing using curly braces as was (silently) supported since PHP 7.0. #851
    • The sniff will now also throw errors for each dereference found on the array/string, not just the first one.
  • 📌 PHPCompatibility.Syntax.NewClassMemberAccess sniff: the sniff will now also recognize class member access on instantiation and cloning using curly braces as was (silently) supported since PHP 7.0. #852
    • The sniff will now also throw errors for each access detected, not just the first one.
    • The line number on which the error is thrown in now set more precisely.
  • 📌 PHPCompatibility.Syntax.NewFunctionArrayDereferencing sniff: the sniff will now also recognize function array dereferencing using curly braces as was (silently) supported since PHP 7.0. #853
    • The sniff will now also throw errors for each access detected, not just the first one.
    • The line number on which the error is thrown in now set more precisely.
  • ♻️ Various code clean-up and improvements. #849, #850
  • ♻️ Various minor inline documentation fixes. #854, #886
  • 🔧 Travis: various tweaks to the build script. #834, #842

Fixed

  • 🐛 PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameName sniff: variable names are case-sensitive, so recognition of same named parameters should be done in a case-sensitive manner. #848
  • 🐛 PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: Exceptions thrown within a try should not trigger the sniff. #880. Fixes #863
  • 🐛 PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: the $ooScopeTokens property should never have been a public property. #880.
  • ☔ Some of the unit tests for the PHPCompatibility.Operators.RemovedTernaryAssociativity sniff were not being run. #836