IMPORTANT: This release contains breaking changes. Please read and follow the Upgrade guide in the wiki carefully before upgrading!
If you use any of the framework/CMS/polyfill specific rulesets, please use the corresponding release for that package.
Highlighted Changes
- Policy change: As of this release, PHPCompatibility will no longer support a wide range of PHP_CodeSniffer versions.
The minimum supported PHP_CodeSniffer version will be raised anytime syntax support for a new PHP feature is added to PHP_CodeSniffer and this syntax support is needed for the PHPCompatibility sniffs. - Policy change: As of this release, the only supported manner of installation of PHPCompatibility will be via Composer.
Installation using git clones or with the PHP_CodeSniffer PHAR files is still possible, but no support will be provided for this. - New runtime dependencies:
- The Composer plugin to register the standard with PHP_CodeSniffer.
- PHPCSUtils, a library of utility function for PHP_CodeSniffer.
- All PHPCompatibility sniffs are now
finalclasses.- This prevents issues with sniff autoloading.
- All sniffs are now compatible with PHP_CodeSniffer 3.x as well as 4.0.
Changelog for version 10.0.0-alpha1
See all related issues and PRs in the 10.0.0-alpha1 milestone and in the CHANGELOG file.
Added
- New dependencies:
- PHP cross-version:
- PHP 5.3:
- PHP 5.4:
- PHP 7.0:
- PHP 7.2:
- PHP 7.4:
- PHP 8.0:
- 🌟 New
PHPCompatibility.Attributes.NewAttributessniff. #1279, #1480, #1730, #1926 - 🌟 New
PHPCompatibility.Classes.ForbiddenExtendingFinalPHPClasssniff. #1486, #1739 - 🌟 New
PHPCompatibility.Classes.NewConstructorPropertyPromotionsniff. #1417 - 🌟 New
PHPCompatibility.ControlStructures.NewNonCapturingCatchsniff. #1151 - 🌟 New
PHPCompatibility.FunctionDeclarations.ForbiddenFinalPrivateMethodssniff. #1201 - 🌟 New
PHPCompatibility.FunctionDeclarations.NewTrailingCommasniff. #1164, #1190 - 🌟 New
PHPCompatibility.FunctionDeclarations.RemovedCallingDestructAfterConstructorExitsniff. #1200, #1227, #1283 - 🌟 New
PHPCompatibility.FunctionDeclarations.RemovedOptionalBeforeRequiredParamsniff. #1165, #1206, #1692, #1699, #1886 - 🌟 New
PHPCompatibility.FunctionUse.NewNamedParameterssniff. #1423, #1806, #1807 - 🌟 New
PHPCompatibility.ParameterValues.ChangedIntToBoolParamTypesniff. #1232, #1370 - 🌟 New
PHPCompatibility.ParameterValues.ForbiddenGetClassNoArgsOutsideOOsniff. #1602 - 🌟 New
PHPCompatibility.ParameterValues.RemovedGetDefinedFunctionsExcludeDisabledFalsesniff. #1150, #1162, #1386, #1880 - 🌟 New
PHPCompatibility.ParameterValues.RemovedSplAutoloadRegisterThrowFalsesniff. #1181, #1391, #1882 - 🌟 New
PHPCompatibility.Syntax.InterpolatedStringDereferencingsniff. #1242 - 🌟 New
PHPCompatibility.Syntax.NewMagicConstantDereferencingsniff. #1233
- 🌟 New
- PHP 8.1:
- 🌟 New
PHPCompatibility.Classes.NewFinalConstantssniff. #1317, #1496, #1629 - 🌟 New
PHPCompatibility.Classes.NewReadonlyPropertiessniff. #1426 - 🌟 New
PHPCompatibility.FunctionDeclarations.RemovedReturnByReferenceFromVoidsniff. #1316, #1560 - 🌟 New
PHPCompatibility.InitialValue.NewNewInDefinesniff. #1465 - 🌟 New
PHPCompatibility.InitialValue.NewNewInInitializerssniff. #1464 - 🌟 New
PHPCompatibility.Interfaces.RemovedSerializablesniff. #1330 - 🌟 New
PHPCompatibility.Numbers.NewExplicitOctalNotationsniff. #1420 - 🌟 New
PHPCompatibility.ParameterValues.NewArrayMergeRecursiveWithGlobalsVarsniff. #1488 - 🌟 New
PHPCompatibility.ParameterValues.NewHTMLEntitiesFlagsDefaultsniff. #1419 - 🌟 New
PHPCompatibility.ParameterValues.RemovedMbCheckEncodingNoArgssniff. #1315 - 🌟 New
PHPCompatibility.ParameterValues.RemovedVersionCompareOperatorssniff. #1418 - 🌟 New
PHPCompatibility.Syntax.NewFirstClassCallablessniff. #1425, #1807 - 🌟 New
PHPCompatibility.Variables.RemovedIndirectModificationOfGlobalssniff. #1487
- 🌟 New
- PHP 8.2:
- 🌟 New
PHPCompatibility.Classes.NewReadonlyClassessniff. #1453, #1686 - 🌟 New
PHPCompatibility.Constants.NewConstantsInTraitssniff. #1443 - 🌟 New
PHPCompatibility.ParameterValues.RemovedGetClassNoArgsssniff. #1614 - 🌟 New
PHPCompatibility.ParameterValues.RemovedLdapConnectSignaturessniff. #1620, #1671, #1881 - 🌟 New
PHPCompatibility.ParameterValues.RemovedMbStrimWidthNegativeWidthsniff. #1615 - 🌟 New
PHPCompatibility.TextStrings.RemovedDollarBraceStringEmbedssniff. #1424
- 🌟 New
- PHP 8.3:
- PHP 8.4:
- 🌟 New
PHPCompatibility.Classes.ForbiddenClassNameUnderscoresniff. #1742 - 🌟 New
PHPCompatibility.Classes.NewAbstractPropertiessniff. #1901 - 🌟 New
PHPCompatibility.Classes.NewFinalPropertiessniff. #1815 - 🌟 New
PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParamsniff. #1689, #1694, #1897 - 🌟 New
PHPCompatibility.Interfaces.NewPropertiesInInterfacessniff. #1814 - 🌟 New
PHPCompatibility.ParameterValues.NewExitAsFunctionCallsniff. #1807, #1923 - 🌟 New
PHPCompatibility.ParameterValues.RemovedDbaKeySplitNullFalsesniff. #1745, #1879 - 🌟 New
PHPCompatibility.ParameterValues.RemovedTriggerErrorLevelsniff. #1741 - 🌟 New
PHPCompatibility.ParameterValues.RemovedXmlSetHandlerCallbackUnsetsniff. #1744 - 🌟 New
PHPCompatibility.Syntax.NewClassMemberAccessWithoutParenthesessniff. #1903
- 🌟 New
- ⭐
PHPCompatibility.Constants.NewMagicClassConstant: detection of$obj::classas allowed since PHP 8.0. #1166 - ⭐
PHPCompatibility.Operators.NewOperators: detection of the PHP 8.0 nullsafe object operator. #1210 - ⭐ All "list based" sniffs, like
NewFunctions,RemovedIniDirectives,ForbiddenNamesetc, have received updates to account for more new/deprecated/removed PHP classes, constants, functions, function parameters, hash algorithms, interfaces, ini directives, reserved keywords and type casts.
The listed information in these sniffs has also received general accuracy and completeness updates. - ⭐ All type declaration related sniffs have received updates to account for new type keywords (like
mixedandnever) and new type syntaxes (union, intersection and DNF types) introduced in PHP. - ⭐ A number of Helper classes and traits (for internal use only - see #1484).
- 📚 Documentation for the following sniffs:
- PHPCompatibility.Classes.NewConstVisibility #1323
- PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors #1292
- PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames #1293
- PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue #1294
- PHPCompatibility.ParameterValues.RemovedPCREModifiers #1295
- PHPCompatibility.UseStatements.NewGroupUseDeclarations #1470
- PHPCompatibility.UseStatements.NewUseConstFunction #1470
- PHPCompatibility.Variables.NewUniformVariableSyntax #1539
- Additionally, nearly all newly added sniffs include documentation.
Changed
- 💕 All sniffs are now cross-version compatibility with both PHP_CodeSniffer 3.x as well as 4.x. #1911
- 🔥 All PHPCompatibility sniffs are now
finalclasses. #1261, #1273, #1875. Fixes #608, #638, #793, #1042
Sniffs extending other sniffs can cause problems with the autoloading in PHP_CodeSniffer, leading to "class already declared" errors. - 🔀 The
PHPCompatibility.Classes.ForbiddenAbstractPrivateMethodssniff has been renamed toPHPCompatibility.FunctionDeclarations.AbstractPrivateMethodsand now also detects the PHP 8.0 change to allowabstract privatemethods in traits. #1149 - 🔀 The
PHPCompatibility.Miscellaneous.ValidIntegershas been moved to theNumberscategory and is now calledPHPCompatibility.Numbers.ValidIntegers. #1004 - 🔀 The check for the PHP 7.0 change in how hexadecimal numeric strings are handled, has been removed from the
PHPCompatibility.Miscellaneous.ValidIntegerssniff and now lives in a dedicated sniff, calledPHPCompatibility.Numbers.RemovedHexadecimalNumericStrings. #1004 - 🔀
PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations: theInvalidTypeHintFounderror code has been split into two error codes. #1727. Fixes #1726- The
InvalidTypeHintFounderror code remains in effect for types which are invalid in a parameter context. - The new
InvalidLongTypeFounderror code will now warn about the use of "long" types, which are likely typos, but could be valid class names.
- The
- 🔀
PHPCompatibility.Classes.NewTypedProperties: theInvalidTypeerror code has been split into two error codes. #1728- The
InvalidTypeerror code remains in effect for types which are invalid in a property context. - The new
InvalidLongTypeerror code will now warn about the use of "long" types, which are likely typos, but could be valid class names.
- The
- 💚
PHPCompatibility.Upgrade.LowPHP: the minimum recommended PHP version is now 7.2.0. #1550 - 📌 The
testVersionconfiguration variable will now also be recognized when provided in lowercase (testversion). #969 - 📌 Passing an invalid
testVersionwill now result in either anInvalidTestVersionor anInvalidTestVersionRangeException being thrown. #1548 - 📌 A lot of the sniffs have had updates to handle various new PHP syntaxes and features.
⚠️ Note: this task is not yet complete, so some sniffs may still throw false positives/negatives when confronted with modern PHP. - 📌
MiscHelper::isUseOfGlobalConstant()will no longer recognize constant declarations as "use of". #1888 - 📌 Both the
PHPCompatibility.Constants.NewConstantsas well as thePHPCompatibility.Constants.RemovedConstantssniffs now special case the handling of theT_BAD_CHARACTERconstant, which was removed from PHP in PHP 7.0, but then re-introduced in PHP 7.4. #1586. Fixes #1351 - 📌
PHPCompatibility.Classes.RemovedOrphanedParentthe$classScopeTokensproperty is nowprivate, it should never have beenpublicin the first place. #983 - 📌
PHPCompatibility.Classes.RemovedOrphanedParentwill now also flagparentwhen used as a type declaration in an interface. #1499 - 📌
PHPCompatibility.ControlStructures.NewExecutionDirectivesnow more accurately determines whether the value of a directive is valid. #1416 - 📌
PHPCompatibility.FunctionDeclarations.NonStaticMagicMethodswill now also flag incorrect modifiers for the__wakeup()method, as enforced by PHP since PHP 8.0. #1821 - 📌
PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructorswill not report on PHP-4 style constructors if the minimum supported PHP version, as indicated viatestVersion, is PHP 8.0 or higher, as on PHP 8.0 the concept of PHP-4 style constructors no longer exists in PHP. #1563 - 📌
PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNameswill now bow out for the PHP 7.4__serialize()and__unserialize()magic methods. #1142 - 📌
PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNameswill now ignore deprecated functions more consistently. #1564 - 📌
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewill now throw an error, instead of a warning, when a passed parameter isunset(). #1286 - 📌
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewill now recognize and handle numeric$optionsbeing passed to the target function calls. #1892 - 📌
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewill now warn against the use ofdebug_*backtrace()as a PHP 8.1+ first class callable. #1892 - 📌
PHPCompatibility.Interfaces.InternalInterfaceswill now also flag internal interfaces which cannot be extended when used in anextendsclause. #1566 - 📌
PHPCompatibility.Interfaces.NewInterfaceswill now detect interfaces used incatchconditions. #968. Fixes #967 - 📌
PHPCompatibility.Interfaces.NewInterfaceswill now also detect new interfaces when used in anextendsclause. #1259 - 📌
PHPCompatibility.Keywords.ForbiddenNameswill no longer report on reserved keywords being used in a namespace name as allowed since PHP 8.0 (reporting depends on thetestVersionpassed). #1402 - 📌
PHPCompatibility.Keywords.ForbiddenNameswill now strictly only flag forbidden names at the point of declaration. #1368 - 📌
PHPCompatibility.Keywords.ForbiddenNameswill now also check for declarations using "other" and soft reserved keywords. #1399
This was previously checked via thePHPCompatibility.Keywords.ForbiddenNamesAsDeclaredsniff (now removed). - 📌
PHPCompatibility.Keywords.ForbiddenNameswill not flag keywords, introduced in PHP 7.0 or later, when used as method or OO constant names, as this is not a compatibility issue. #1633, #1641 - 📌
PHPCompatibility.Keywords.ForbiddenNameswill not flag keywords, introduced in PHP 8.0 or later, when used in a namespace name, as this is not a compatibility issue. #1641 - 📌
PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault: will now also sniff for affected function calls toget_html_translation_table(). #1041 - 📌
PHPCompatibility.Syntax.NewFunctionCallTrailingCommawill now also detect trailing commas in exit/die as function calls (PHP 8.4+). #1807 - ✏️ Various sniffs which would warn for the use of a deprecated feature have been updated to throw an error for PHP 8.0 having removed these features.
- ✏️ The error messages of various sniffs have been improved.
In some cases, the line on which the error is thrown may have changed to flag the problematic code with higher precision. - ✏️ The error levels (warning vs error) used in all sniffs have been reviewed and made consistent. #1282. Fixes #1163
PHP deprecations should translate to a warning from PHPCompatibility, PHP removals and new features should translate to an error.
This also impacts some of the error codes as detailed in the upgrade guide. - ✏️ The error codes of various (modular) warnings/errors have changed in light of parameter name renames done in PHP Core to support named arguments in PHP 8.0.
- ✏️ Various sniffs no longer get confused over comments in unexpected places.
- ✏️ Various sniffs now have improved parse error/live coding tolerance.
- 🔧 Composer: a
replacedirective has been added to discourage use of the old package name. #976 - 🔧 Composer: The package will now identify itself as a static analysis tool. #1346
- 🔧 ☔ Various housekeeping, including general maintenance, improvements to speed up the sniffs, improvements to CI, the tests and documentation.
Removed
- 🚫 Support for PHP 5.3. #956. Fixes #835
- 🚫 Support for PHP_CodeSniffer < 3.13.3. #956, #1352, #1355, #1662, #1686, #1714, #1806, #1900. Fixes #835, #1347
- 🚫
PHPCompatibility.Keywords.ForbiddenNamesAsInvokedFunctionssniff. #1367. Fixes #105, #1024 - 🚫
PHPCompatibility.Keywords.ForbiddenNamesAsDeclaredsniff. #1399. Fixes #1024 - 🚫
PHPCompatibility.Upgrade.LowPHPCSsniff. #1549 - 🚫
PHPCompatibility\PHPCSHelperclass in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\AbstractComplexVersionSniffclass in favour of internal Helper traits. #1406 - 🚫
PHPCompatibility\AbstractNewFeatureSniffclass in favour of internal Helper traits. #1406 - 🚫
PHPCompatibility\AbstractRemovedFeatureSniffclass in favour of internal Helper traits. #1406 - 🚫
PHPCompatibility\ComplexVersionInterfaceclass in favour of internal Helper traits. #1406 - 🚫
PHPCompatibility\Sniff::addMessage()in favour of PHPCSUtils. #1363 - 🚫
PHPCompatibility\Sniff::arrayKeysToLowercase(). Use the PHP nativearray_change_key_case()function instead. #979 - 🚫
PHPCompatibility\Sniff::determineNamespace()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::doesFunctionCallHaveParameters()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getCompleteTextString()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getDeclaredNamespaceName()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getFQClassNameFromDoubleColonToken()in favour of an internal Helper class. #1571 - 🚫
PHPCompatibility\Sniff::getFQClassNameFromNewToken()in favour of an internal Helper class. #1571 - 🚫
PHPCompatibility\Sniff::getFQExtendedClassName()in favour of an internal Helper class. #1571 - 🚫
PHPCompatibility\Sniff::getFQName()in favour of an internal Helper class. #1571 - 🚫
PHPCompatibility\Sniff::getFunctionCallParameter()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getFunctionCallParameters()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getFunctionCallParameterCount()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::getHashAlgorithmParameter()in favour of an internal Helper trait. #1250 - 🚫
PHPCompatibility\Sniff::getReturnTypeHintName()in favour of PHPCSUtils. #1448 - 🚫
PHPCompatibility\Sniff::getReturnTypeHintToken()in favour of PHPCSUtils. #1448 - 🚫
PHPCompatibility\Sniff::getTypeHintsFromFunctionDeclaration()in favour of PHPCSUtils. #1448 - 🚫
PHPCompatibility\Sniff::inClassScope()in favour of PHPCSUtils. #1429 - 🚫
PHPCompatibility\Sniff::isClassProperty()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::isClassConstant()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::isNamespaced()without replacement. #1551 - 🚫
PHPCompatibility\Sniff::isNegativeNumber()in favour of an internal Helper class. #1493, #1567 - 🚫
PHPCompatibility\Sniff::isNumber()in favour of an internal Helper class. #1493, #1567 - 🚫
PHPCompatibility\Sniff::isNumericCalculation()in favour of an internal Helper class. #1568 - 🚫
PHPCompatibility\Sniff::isPositiveNumber()in favour of an internal Helper class. #1493, #1567 - 🚫
PHPCompatibility\Sniff::isShortList()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::isShortTernary()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::isUnaryPlusMinus()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::isUseOfGlobalConstant()in favour of an internal Helper class. #1572 - 🚫
PHPCompatibility\Sniff::isVariable()in favour of an internal Helper class. #1570 - 🚫
PHPCompatibility\Sniff::stringToErrorCode()in favour of PHPCSUtils. #1363 - 🚫
PHPCompatibility\Sniff::stripQuotes()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::stripVariables()in favour of PHPCSUtils. #1398 - 🚫
PHPCompatibility\Sniff::supportsAbove()in favour of an internal Helper class. #1237, #1555 - 🚫
PHPCompatibility\Sniff::supportsBelow()in favour of an internal Helper class. #1237, #1555 - 🚫
PHPCompatibility\Sniff::tokenHasScope()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::validDirectScope()in favour of PHPCSUtils. #979 - 🚫
PHPCompatibility\Sniff::$iniFunctionswithout replacement. #1251 - 🚫
PHPCompatibility\Sniff::$hashAlgoFunctionsin favour of an internal Helper trait. #1250 - 🚫
PHPCompatibility\Sniff::$superglobalsin favour of PHPCSUtils. #1018 - 🚫
PHPCompatibility\Sniff::REGEX_COMPLEX_VARSin favour of PHPCSUtils. #1398
Fixed
- 🐛 Deprecation notice in
testVersionhandling when running on PHP 8.1+. #1276 - 🐛 Sniffs looking for function calls will now determine more accurately if whatever is being looked at, is actually a (non-namespaced) function call. #962, related to #961
- 🐛 Various sniffs explicitly looking for/ignoring
null/true/falsecould get confused over fully qualified and/or non-lowercase use of these keywords. #1877, #1902, #1906 - 🐛
PHPCompatibility.Classes.NewClasseswill no longer throw false positives for imported namespaced classes with a class name overlapping one of the new global PHP classes. #1695. Fixes #1291 - 🐛
PHPCompatibility.Classes.NewClassesandPHPCompatibility.Classes.RemovedClassesdid not always correctly correlate the class name fromself. #1893 - 🐛
PHPCompatibility.Classes.NewLateStaticBindingdid not flaginstanceof staticor `new static. #957 - 🐛
PHPCompatibility.Classes.NewTypedPropertiesPHP native build-in types should be handled case-insensitively. #1205 - 🐛
PHPCompatibility.Classes.NewTypedPropertiesfalse negative for edge case where a property declaration would be closed via a PHP close tag. #1703 - 🐛
PHPCompatibility.Classes.RemovedClasseswill no longer throw false positives for imported namespaced classes with a class name overlapping one of the new global PHP classes. #1924 - 🐛
PHPCompatibility.Classes.RemovedOrphanedParentcould get confused over an upstream tokenizer issue when a function declared to return by reference would be called "parent". #1499. Fixes #1489 - 🐛
PHPCompatibility.Constants.NewConstantsandPHPCompatibility.Constants.RemovedConstantswill throw fewer false positives for constructs which are not a global constant, but mirror the name of a PHP constant. #1888 - 🐛
PHPCompatibility.Constants.NewMagicClassConstantwould incorrectly flag static function calls to a method calledclass. #1500 - 🐛
PHPCompatibility.ControlStructures.NewExecutionDirectives: directive names should be handled case-insensitively. #1416 - 🐛
PHPCompatibility.ControlStructures.NewExecutionDirectives: multi-directive statements were not analyzed correctly. #1416 - 🐛
PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameNamedid not examine abstract methods or interface methods. #991 - 🐛
PHPCompatibility.FunctionDeclarations.NewClosurecould get confused over$thisandselfbeing used in nested closed structures in the body of the closure. #1928 - 🐛
PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarationsdid not examine nested function declarations. #996 - 🐛
PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarationsPHP native build-in types should be handled case-insensitively. #1203 - 🐛
PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarationswould incorrectly throw theOutsideClassScopeFounderror for PHP < 5.2. #1203 - 🐛
PHPCompatibility.FunctionDeclarations.NewReturnTypeDeclarationsPHP native build-in types should be handled case-insensitively. #1204 - 🐛
PHPCompatibility.FunctionDeclarations.NonStaticMagicMethodswould incorrectly flag non-public__destruct()methods as having the wrong visibility. #1543. Fixes #1542 - 🐛
PHPCompatibility.FunctionNameRestrictions.RemovedNamespacedAssertdid not handle nested function declarations correctly. #1169 - 🐛
PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNamesdid not handle nested function declarations correctly. #1142 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsUsage: TypeError when run on PHP 8.0+. #1213 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsUsagewould throw false positives for namespaced functions mirroring a name of a target function of the sniff. #1890 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsUsagecould get confused over a method declared to return by reference. #1890 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue: prevent false positive when passed parameter is used in a return, exit or throw statement. #1208, #1286. Fixes #1207 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue: prevent false positive when passed parameter is used inisset()orempty(). #1286 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue: prevent false positive when passed parameter is only assigned to another variable in a "simple assignment". #1286. Fixes #1240 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewould incorrectly ignore function calls when passed a namespaced constant mirroring the globalDEBUG_BACKTRACE_IGNORE_ARGSconstant. #1892 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewill now check for calls toarray_slice()/array_splice()case-insensitively and will prevent false negatives if a namespaced function is encountered mirroring the global PHP function we're looking for. #1892 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuenow recognizes and handles negative offsets passed toarray_slice()/array_splice()correctly. #1892 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuenow recognizes and handles the $length parameter if passed toarray_slice()/array_splice(). #1892 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuedid not handle (parameter overrides via) list assignments correctly. #1892 - 🐛
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValuewill now more often recognize when a parameter is touched, but not changed when the parameter is used in a control structure condition. #1892 - 🐛
PHPCompatibility.Interfaces.InternalInterfaceswill no longer throw false positives for imported namespaced classes with a class name overlapping one of the new global PHP classes. #1700. Fixes #1649 - 🐛
PHPCompatibility.Interfaces.NewInterfacesdid not handle nested function declarations correctly. #1259 - 🐛
PHPCompatibility.Interfaces.NewInterfaceswill no longer throw false positives for imported namespaced classes with a class name overlapping one of the new global PHP classes. #1700 - 🐛
PHPCompatibility.InitialValue.NewConstantArraysUsingDefinecould get confused over namespaced function calls and class instantiations. #1518 - 🐛
PHPCompatibility.InitialValue.NewConstantArraysUsingDefinecould fail to detect array values in a compound parameter. #1518 - 🐛
PHPCompatibility.InitialValue.NewConstantArraysUsingDefinecould throw false positives for constants with a closure/arrow function callback as its value. #1518 - 🐛
PHPCompatibility.Keywords.ForbiddenNamesdid not handle nested function declarations correctly. #1368 - 🐛
PHPCompatibility.Keywords.ForbiddenNamesdid not always flag keywords used in a namespace name correctly. #1368 - 🐛
PHPCompatibility.Keywords.ForbiddenNamesdid not always flag aliases in import multi-use, group use and trait use statements correctly. #1368 - 🐛
PHPCompatibility.Lists.ForbiddenEmptyListAssignment: false positive for a hard-coded empty (sub-)array in a foreach iterable expression. #1401. Fixes #1341 - 🐛
PHPCompatibility.ParameterValues.NewFopenModescould throw false positives for dynamically generated parameter values. #1045 - 🐛
PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefaultnow examines each array item in the$optionsparameter individually to prevent false negatives. #1588 - 🐛
PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefaultwould throw false positives for the$encodingparameter not being explicitly passed on functions which didn't exist in PHP 5.6 (when the default value of the parameter was changed). #1779. Fixes #1777 - 🐛
PHPCompatibility.ParameterValues.NewPackFormatcould throw false positives for dynamically generated parameter values. #1044. Fixes #1043 - 🐛
PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValuescould throw false positives for dynamically generated parameter values. #1531 - 🐛
PHPCompatibility.ParameterValues.NewPCREModifiersandPHPCompatibility.ParameterValues.RemovedPCREModifierscould throw false positives for dynamically generated parameter values. #1764 - 🐛
PHPCompatibility.ParameterValues.NewProcOpenCmdArraycould fail to warn about the use ofescapeshellarg()when the PHP 7.4 array format for the$commandparameter is used, if the function call was not in lowercase. #1878 - 🐛
PHPCompatibility.ParameterValues.RemovedIconvEncoding: TypeError when run on PHP 8.0+. #1212 - 🐛
PHPCompatibility.ParameterValues.RemovedMbstringModifierscould throw false positives for dynamically generated parameter values. #1046 - 🐛
PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParamcould throw both false positives as well as have false negatives for dynamically generated parameter values. #1722. Fixes #1721 - 🐛
PHPCompatibility.ParameterValues.RemovedNonCryptoHashSniffdid not handle a fully qualifiedHASH_HMACconstant as a parameter value correctly. #1532 - 🐛
PHPCompatibility.ParameterValues.RemovedSetlocaleStringcould throw false positives for dynamically generated parameter values. #1047 - 🐛
PHPCompatibility.Syntax.ForbiddenCallTimePassByReferencewas not recognized for anonymous class instantiations and class instantiations using hierarchy keywords. #1912 - 🐛
PHPCompatibility.Syntax.NewFlexibleHeredocNowdoctheClosingMarkerNoNewLineerror code was inadvertently used for two different errors. This error code has now been split intoClosingMarkerNoNewLineandCloserFoundInBody. #1697. Fixes #1696 - 🐛
PHPCompatibility.Syntax.NewFunctionCallTrailingCommawould throw a false positive for a trailing comma in a function declaration if the function was declared to return by reference. #1534 - 🐛
PHPCompatibility.Syntax.NewFunctionCallTrailingCommafalse negative on trailing comma in class instantiations. #1534 - 🐛
PHPCompatibility.Syntax.NewShortArraywould incorrectly also flag short lists. #1010 - 🐛
PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccessdid not flag curly brace array access on a namespaced constant. #1889 - 🐛
PHPCompatibility.UseDeclarations.NewUseConstFunctioncould throw false positive in some parse error edge cases. #1537 - 🐛
PHPCompatibility.Variables.ForbiddenThisUseContextsfalse positive for use of$thisinunset(), while$thisis not the variable being unset. #1670. Fixes #1666 - 🐛
PHPCompatibility.Variables.NewUniformVariableSyntaxdid not handle static access using the hierarchy keywords correctly. #1013 - 🐛
PHPCompatibility.Variables.RemovedPredefinedGlobalVariablesfalse positive on static access to class property shadowing the name of one of the removed global variables. #1014 - 🐛
PHPCompatibility.Variables.RemovedPredefinedGlobalVariablesdid not correctly limit the scope of the token walking to determine whether$php_errormsgwas the deprecated global variable. #1014
Credits
Thanks go out to @afilina, @bebehr, @diedexx, @elazar, @Flyingmana, @fredden, @GaryJones, @hugovk, @kporras07, @MarkMaldaba, @magikstm, @rdss-sknott, @stevegrunwell, @stronk7 and @zeriyoshi for their contributions to this version. 👏
Additionally thanks go out to everyone who has been testing the develop branch and has reported issues to help us get to where we are now.