Update phpcompatibility/php-compatibility in / from 8.2.0 to 9.0.0 #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dependencies.io has updated
phpcompatibility/php-compatibility
(a packagist dependency in/
) from "8.2.0" to "9.0.0".9.0.0
IMPORTANT: This release contains breaking changes. Please read the below information carefully before upgrading!
All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names.
Both the
PHPCompatibilityJoomla
[GH | Packagist] as well as thePHPCompatibilityWP
[GH|Packagist] rulesets have already been adjusted for this change and have released a new version which is compatible with this version of PHPCompatibility.Aside from those CMS-based rulesets, this project now also offers a number of polyfill-library specific rulesets, such as
PHPCompatibilityPasswordCompat
[GH | Packagist] for ircmaxell'spassword_compat
libary,PHPCompatibilityParagonieRandomCompat
andPHPCompatibilityParagonieSodiumCompat
[GH|Packagist] for the Paragonie polyfills and a number of rulesets related to various polyfills offered by the Symfony project [GH|Packagist].If your project uses one of these polyfills, please consider using these special polyfill rulesets to prevent false positives.
Also as of this version, Juliette Reinders Folmer is now officially a co-maintainer of this package.
Upgrade instructions
<exclude name="..."/>
directives in your own project's custom ruleset which relate to sniffs from the PHPCompatibility library, you will need to update your ruleset to use the new sniff names.// phpcs:ignore Standard.Category.SniffName
, in combination with PHPCompatibility sniff names, you will need to update these annotations.Overview of all the sniff renames:
Changelog for version 9.0.0
See all related issues and PRs in the 9.0.0 milestone.
Added
PHPCompatibility.ControlStructures.NewForeachExpressionReferencing
sniff to detect referencing of$value
within aforeach()
when the iterated array is not a variable. This was not supported prior to PHP 5.5. #664PHPCompatibility.ControlStructures.NewListInForeach
sniff to detect unpacking nested arrays into separate variables via thelist()
construct in aforeach()
statement. This was not supported prior to PHP 5.5. #657PHPCompatibility.FunctionNameRestrictions.RemovedNamespacedAssert
sniff to detect declaring a function calledassert()
within a namespace. This has been deprecated as of PHP 7.3. #735. Partially fixes #718.PHPCompatibility.Lists.AssignmentOrder
sniff to detectlist()
constructs affected by the change in assignment order in PHP 7.0. #656PHPCompatibility.Lists.NewKeyedList
sniff to detect usage of keys inlist()
, support for which was added in PHP 7.1. #655. Fixes #252.PHPCompatibility.Lists.NewListReferenceAssignment
sniff to detect reference assignments being used inlist()
constructs, support for which has been added in PHP 7.3. #731PHPCompatibility.Lists.NewShortList
sniff to detect the shorthand array syntax[]
being used for symmetric array destructuring as introduced in PHP 7.1. #654. Fixes #248.PHPCompatibility.Operators.NewOperators
sniff which checks for usage of the pow, pow equals, spaceship and coalesce (equals) operators. #738These checks were previously contained within the
PHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff.PHPCompatibility.ParameterValues.ForbiddenGetClassNull
sniff to detectnull
being passed toget_class()
, support for which has been removed in PHP 7.2 #659. Fixes #557.PHPCompatibility.ParameterValues.NewArrayReduceInitialType
sniff to detect non-integers being passed as the$initial
parameter to thearray_reduce()
function, which was not supported before PHP 5.3. #666. Fixes #649PHPCompatibility.ParameterValues.NewFopenModes
sniff to examine the$mode
parameter passed tofopen()
for modes not available in older PHP versions. #658PHPCompatibility.ParameterValues.NewNegativeStringOffset
sniff to detect negative string offsets being passed to string manipulation functions which was not supported before PHP 7.1. #662. Partially fixes #253.PHPCompatibility.ParameterValues.NewPackFormats
sniff to examine the$format
parameter passed topack()
for formats not available in older PHP versions. #665PHPCompatibility.ParameterValues.RemovedIconvEncoding
sniff to detect the PHP 5.6 deprecated encoding$type
s being passed toiconv_set_encoding()
. #660. Fixes #475.PHPCompatibility.ParameterValues.RemovedNonCryptoHashes
sniff to detect non-cryptographic hash algorithms being passed to varioushash_*()
functions. This is no longer accepted as of PHP 7.2. #663. Fixes #559PHPCompatibility.ParameterValues.RemovedSetlocaleString
sniff to detect string literals being passed to the$category
parameter of thesetlocale()
function. This behaviour was deprecated in PHP 4.2 and support has been removed in PHP 7.0. #661PHPCompatibility.Syntax.NewFlexibleHeredocNowdoc
sniff to detect the new heredoc/nowdoc format as allowed as of PHP 7.3. #736. Fixes #705.Note: This sniff is only supported in combination with PHP_CodeSniffer 2.6.0 and higher.
PHPCompatibility.Classes.NewClasses
sniff: recognize the newCompileError
andJsonException
classes as introduced in PHP 7.3. #676PHPCompatibility.Constants.NewConstants
sniff: recognize new constants which are being introduced in PHP 7.3. #678PHPCompatibility.Constants.RemovedConstants
sniff: recognize constants which have been deprecated or removed in PHP 7.3. #710. Partially fixes #718.PHPCompatibility.FunctionUse.NewFunctions
sniff: recognize various new functions being introduced in PHP 7.3. #679PHPCompatibility.FunctionUse.NewFunctions
sniff: recognize thesapi_windows_*()
,hash_hkdf()
andpcntl_signal_get_handler()
functions as introduced in PHP 7.1. #728PHPCompatibility.FunctionUse.RemovedFunctionParameters
sniff: recognize the deprecation of the$case_insensitive
parameter for thedefine()
function in PHP 7.3. #706PHPCompatibility.FunctionUse.RemovedFunctions
sniff: recognize the PHP 7.3 deprecation of theimage2wbmp()
,fgetss()
andgzgetss()
functions, as well as the deprecation of undocumented Mbstring function aliases. #681, #714, #720. Partially fixes #718.PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters
sniff: account for the second parameter forarray_push()
andarray_unshift()
becoming optional in PHP 7.3, as well as for the$mode
parameter for a range offtp_*()
functions becoming optional. #680PHPCompatibility.IniDirectives.NewIniDirectives
sniff: recognize newsyslog
andsession
ini directives as introduced in PHP 7.3. #702, #719, #730PHPCompatibility.IniDirectives.NewIniDirectives
sniff: recognize some more ini directives which were introduced in PHP 7.1. #727PHPCompatibility.IniDirectives.RemovedIniDirectived
sniff: recognize ini directives removed in PHP 7.3. #677, #717. Partially fixes #718.isNumericCalculation()
andisVariable()
utility methods to thePHPCompatibility\Sniff
class. #664, #666Contributing
file. #738Changed
See the table at the top of this changelog for details of all the file renames.
BaseSniffTest::sniffFile()
method has been adjusted to match. The signature of this method has changed. Where it previously expected a relative path to the unit test case file, it now expects an absolute path.PHPCompatibility\Sniff
class have been moved to a newPHPCompatibility\Util\Tests\Core
subdirectory.phpunit-bootstrap.php
.PHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff has been split into two sniffs. #738The
PHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff now contains just the checks for the namespace separator and the ellipsis.The new
PHPCompatibility.Operators.NewOperators
sniff now contains the checks regarding the pow, pow equals, spaceship and coalesce (equals) operators.PHPCompatibility.ParameterValues.RemovedMbstringModifiers
sniff will now also recognize removed regex modifiers when used within a function call to one of the undocumented Mbstring function aliases for the Mbstring regex functions. #715PHPCompatibility\Sniff::getFunctionCallParameter()
utility method now allows for closures called via a variable. #723PHPCompatibility.Upgrade.LowPHPCS
: the minimum supported PHPCS version is now 2.3.0. #699PHPCompatibility.FunctionNameRestrctions.RemovedMagicAutoload
sniff. #716Removed
The minimum recommended version of PHP_CodeSniffer remains the same, i.e. 2.6.0.
\PHPCompatibility\Sniff::inUseScope()
method has been removed as it is no longer needed now support for PHPCS 1.x has been dropped. #699autoload
section has been removed from thecomposer.json
file. #738. Fixes #568.Autoloading for this library is done via the PHP_CodeSniffer default mechanism, enhanced with our own autoloader, so the Composer autoloader shouldn't be needed and was causing issues in a particular use-case.
Fixed
PHPCompatibility.FunctionUse.NewFunctionParameters
sniff: The new$mode
parameter of thephp_uname()
function was added in PHP 4.3, not in PHP 7.0 as was previously being reported.The previous implementation of this check was based on an error in the PHP documentation. The error in the PHP documentation has been rectified and the sniff has followed suit. #711
PHPCompatibility.Generators.NewGeneratorReturn
sniff: The sniff would throw false positives forreturn
statements in nested constructs and did not correctly detect the scope which should be examined. #725. Fixes #724.PHPCompatibility.Keywords.NewKeywords
sniff: PHP magic constants are case _in_sensitive. This sniff now accounts for this. #707PHPCompatibility.Syntax.ForbiddenCallTimePassByReference
sniff #723:Credits
Thanks go out to Jonathan Champ for his contribution to this version. 👏