Changelog History
Page 1
-
v9.3.5 Changes
December 27, 2019๐ See all related issues and PRs in the 9.3.5 milestone.
โ Added
- ๐ฑ โญ๏ธ
PHPCompatibility.Classes.NewClasses
sniff: recognize the newFFI
extension related classes as introduced in PHP 7.4. #949 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.NewIniDirectives
sniff: detect use of the newFFI
extension related ini directives as introduced in PHP 7.4. #949
๐ Changed
- ๐ฑ ๐
PHPCompatibility.Syntax.NewShortArray
: improved clarity of the error message and made it consistent with other error messages in this standard. #934 - โก๏ธ ๐
PHPCompatibility.Interfaces.NewInterfaces
: updated the URL which is mentioned in select error messages. #942 - ๐ โป๏ธ Another slew of code documentation fixes. #937, #939, #940, #941, #943, #944, #951, #950. Fixes #734.
- ๐ ๐ Travis: various tweaks. The builds against PHP 7.4 are no longer allowed to fail. #935, #938
For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+ as PHP_CodeSniffer itself is
not compatible with PHP 7.4 until version 3.5.0.
๐ Fixed
- ๐ฑ ๐
PHPCompatibility.Classes.NewClasses
: two new PHP 7.4 classes were being checked as if they were Exceptions. #945
Credits
๐ฑ Thanks go out to William Entriken for their contribution to this version. ๐
- ๐ฑ โญ๏ธ
-
v9.3.4 Changes
November 15, 2019๐ See all related issues and PRs in the 9.3.4 milestone.
๐ Fixed
- ๐ฑ ๐
PHPCompatibility.Keywords.ForbiddenNames
: false positive forlist
when used in aforeach()
condition. #930. Fixes #928, #929
Credits
๐ฑ Thanks go out to Sergii Bondarenko for their contribution to this version. ๐
- ๐ฑ ๐
-
v9.3.3 Changes
November 11, 2019๐ See all related issues and PRs in the 9.3.3 milestone.
โ Added
- ๐ฑ โญ๏ธ
PHPCompatibility.Constants.NewConstants
sniff: detection of yet more (undocumented) PHP 7.2 Sodium constants. #924 - ๐ฑ โญ๏ธ
PHPCompatibility.Keywords.ForbiddenNames
sniff: detect the use of more reserved keywords which are not allowed to be used to name certain constructs. #923. Fixes #922
๐ Fixed
- ๐
๐
PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors
: false positive detecting PHP4-style constructors when declared in interfaces. The class implementing the interface will not have the same name as the interface, so the actual method would not be regarded as a PHP4 style constructor. #921
Credits
๐ฑ Thanks go out to Nikhil for their contribution to this version. ๐
- ๐ฑ โญ๏ธ
-
v9.3.2 Changes
October 16, 2019๐ See all related issues and PRs in the [9.3.2 milestone].
โ Added
- โญ๏ธ
PHPCompatibility.Constants.NewConstants
sniff: detection of the PHP 7.2SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13
constant. #915 - ๐ ๐ Readme: a list of projects which are build upon or extend PHPCompatibility. #904
๐ Changed
- ๐
๐
PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors
: minor efficiency fix to make the sniff faster. #912 - ๐ฑ ๐
PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
: functions marked as@deprecated
in the function docblock will now be ignored by this sniff. #917. Fixes #911 - ๐ฑ ๐
PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters
: the$ooScopeTokens
property is nowprotected
, it should never have beenpublic
in the first place. #907 - ๐ โป๏ธ More code documentation fixes. #903, #916
- ๐ฑ ๐ Readme/Contributing: various tweaks. #904, #905
๐ Fixed
- ๐ฑ ๐
PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters
: false positive when a class is instantiated which has the same name as one of the affected functions. #914. Fixes #913 - ๐ฑ ๐
PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters
: false positive when a class is instantiated which has the same name as one of the affected functions. #914 - ๐ฑ ๐
PHPCompatibility.MethodUse.NewDirectCallsToClone
: false positive on calling__clone()
from within the class being cloned #910. Fixes #629 (comment) - ๐ฑ ๐
PHPCompatibility.Miscellaneous.ValidIntegers
: binary numbers using an uppercaseB
were not always recognized correctly. #909
- โญ๏ธ
-
v9.3.1 Changes
September 06, 2019๐ See all related issues and PRs in the 9.3.1 milestone.
๐ Changed
- ๐ โป๏ธ A whole slew of code documentation fixes. #892, #895, #896, #897, #898, #899, #900
- ๐ ๐ง Travis: minor tweaks to the build script. #893
๐ Fixed
- ๐ฑ ๐
PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder
: false positive when an array item in the second parameter contained a ternary. #891. Fixes #890 - ๐ฑ ๐
PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder
: will now take array casts into account when determining which parameter is$pieces
. #891. - ๐ฑ ๐
PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder
: hardening of the logic to not examine the second parameter when the first is just and only a text string ($glue
). #891.
-
v9.3.0 Changes
August 29, 2019๐ 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 tostrip_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 tohtml_entity_decode()
,htmlentities()
andhtmlspecialchars()
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 thedefault_charset
value in PHP 5.6. #864 Fixes #839 - ๐ New
PHPCompatibility.ParameterValues.NewIDNVariantDefault
sniff to detect calls toidn_to_ascii()
andidn_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 topassword_hash()
andpassword_needs_rehash()
impacted by the changed value of thePASSWORD_DEFAULT
,PASSWORD_BCRYPT
,PASSWORD_ARGON2I
andPASSWORD_ARGON2ID
constants in PHP 7.4. #865 - ๐ฑ ๐ New
PHPCompatibility.ParameterValues.NewProcOpenCmdArray
sniff to detect calls toproc_open()
passing an array for the$cmd
parameter as supported as of PHP 7.4. #869 - ๐ท ๐ New
PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray
sniff to detect calls tostrip_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 detectimplode()
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, tomb_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 newWeakReference
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 revivedT_BAD_CHARACTER
constant as re-introduced in PHP 7.4. #882 - โญ๏ธ
PHPCompatibility.Constants.NewConstants
sniff: detection of the newIMG_FILTER_SCATTER
andPASSWORD_ARGON2_PROVIDER
constants as introduced in PHP 7.4. #887 - ๐ฑ โญ๏ธ
PHPCompatibility.Constants.RemovedConstants
sniff: detection of use of theCURLPIPE_HTTP1
constant which will be deprecated in PHP 7.4. #879 - โญ๏ธ
PHPCompatibility.Constants.RemovedConstants
sniff: detection of use of theFILTER_SANITIZE_MAGIC_QUOTES
constant which will be deprecated in PHP 7.4. #845 - โญ๏ธ
PHPCompatibility.Constants.RemovedConstants
sniff: detection of use of theT_CHARACTER
andT_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 functionimagecreatefromtga()
. #873 - ๐ฑ โญ๏ธ
PHPCompatibility.FunctionUse.RemovedFunctionParameters
sniff: recognize the deprecation of the$age
parameter of thecurl_version()
function. #874 - โญ๏ธ
PHPCompatibility.FunctionUse.RemovedFunctions
sniff: recognize the PHP 7.4 deprecatedconvert_cyr_string()()
,ezmlm_hash()
,get_magic_quotes_gpc()
,get_magic_quotes_runtime()
,hebrevc()
,is_real()
,money_format()
andrestore_include_path()
functions. #847 - โญ๏ธ
PHPCompatibility.IniDirectives.NewIniDirectives
sniff: detect use of the new PHP 7.4zend.exception_ignore_args
ini directive. #871 - โญ๏ธ
PHPCompatibility.IniDirectives.RemovedIniDirectives
sniff: detect use of theallow_url_include
ini directive which is deprecated as of PHP 7.4. #870 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.RemovedIniDirectives
sniff: detection of use of theopcache.load_comments
directive which was removed in PHP 7.0. #v - ๐ฑ โญ๏ธ
PHPCompatibility.ParameterValues.NewHashAlgorithms
: recognize use of the new PHP 7.4crc32c
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 theRemovedExtensions
andRemovedFunctions
sniffs. #841 - ๐ฑ โญ๏ธ Recognize the
OPcache
extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in theNewFunctions
andNewIniDirectives
sniffs. #883 - ๐ฑ โญ๏ธ New
getCompleteTextString()
utility method to thePHPCompatibility\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 andstatic
(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 atry
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
- ๐ฑ ๐ New
-
v9.2.0 Changes
June 27, 2019๐ See all related issues and PRs in the 9.2.0 milestone.
To keep informed of the progress of covering "everything PHP 7.4" in PHPCompatibility, please subscribe to issue #808.
โ Added
- ๐ฑ ๐ New
PHPCompatibility.Classes.ForbiddenAbstractPrivateMethods
sniff to detect methods declared as bothprivate
as well asabstract
. This was allowed between PHP 5.0.0 and 5.0.4, but disallowed in PHP 5.1 as the behaviour ofprivate
andabstract
are mutually exclusive. #822 - ๐ฑ ๐ New
PHPCompatibility.Classes.NewTypedProperties
sniff to detect PHP 7.4 typed property declarations. #801, #829 - ๐ฑ ๐ New
PHPCompatibility.Classes.RemovedOrphanedParent
sniff to detect the use of theparent
keyword in classes without a parent (non-extended classes). This code pattern is deprecated in PHP 7.4 and will become a compile-error in PHP 8.0. #818 - ๐ฑ ๐ New
PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString
sniff to detect throwing exceptions from__toString()
methods. This would previously result in a fatal error, but will be allowed as of PHP 7.4. #814 - ๐ฑ ๐ New
PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters
sniff to detect__toString()
function declarations expecting parameters. This was disallowed in PHP 5.3. #815 - ๐ฑ ๐ New
PHPCompatibility.MethodUse.ForbiddenToStringParameters
sniff to detect direct calls to__toString()
magic methods passing parameters. This was disallowed in PHP 5.3. #830 - ๐ฑ ๐ New
PHPCompatibility.Operators.ChangedConcatOperatorPrecedence
sniff to detect code affected by the upcoming change in operator precedence for the concatenation operator. The concatenation operator precedence will be lowered in PHP 8.0, with deprecation notices for code affected being thrown in PHP 7.4. #805 - ๐ฑ ๐ New
PHPCompatibility.Operators.RemovedTernaryAssociativity
sniff to detect code relying on left-associativity of the ternary operator. This behaviour will be deprecated in PHP 7.4 and removed in PHP 8.0. #810 - ๐ฑ ๐ New
PHPCompatibility.Syntax.NewArrayUnpacking
sniff to detect the use of the spread operator to unpack arrays when declaring a new array, as introduced in PHP 7.4. #804 - ๐ฑ โญ๏ธ
PHPCompatibility.Classes.NewClasses
sniff: recognize the newReflectionReference
class as introduced in PHP 7.4. #820 - ๐ฑ โญ๏ธ
PHPCompatibility.Constants.NewConstants
sniff: detection of the new PHP 7.4 Core (Standard), MBString, Socket and Tidy constants. #821 - โญ๏ธ
PHPCompatibility.FunctionUse.NewFunctions
sniff: detect usage of the new PHP 7.4get_mangled_object_vars()
,mb_str_split()
,openssl_x509_verify()
,password_algos()
,pcntl_unshare()
,sapi_windows_set_ctrl_handler()
andsapi_windows_generate_ctrl_event()
functions. #811, #819, #827 - ๐ฑ โญ๏ธ
PHPCompatibility.FunctionUse.NewFunctions
sniff: recognize the new OCI functions as introduced in PHP 7.2.14 and PHP 7.3.1. #786 - โญ๏ธ
PHPCompatibility.FunctionUse.RemovedFunctions
sniff: recognize the PHP 7.4 deprecatedldap_control_paged_result_response()
andldap_control_paged_result()
functions. #831 - ๐ฑ โญ๏ธ
PHPCompatibility.FunctionUse.RemovedFunctions
sniff: recognize thePayflow Pro/pfpro
functions as removed in PHP 5.1. #823 - ๐ โญ๏ธ
PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters
sniff: account for the parameters forarray_merge()
andarray_merge_recursive()
becoming optional in PHP 7.4. #817 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.RemovedIniDirectives
sniff: recognize thePayflow Pro/pfpro
ini directives as removed in PHP 5.1. #823 - ๐ฑ โญ๏ธ Recognize the
interbase/Firebird
extension functionality which will be removed in PHP 7.4 (moved to PECL) in theRemovedConstants
,RemovedExtensions
,RemovedFunctions
andRemovedIniDirectives
sniffs. #807 - ๐ฑ โญ๏ธ Recognize the
wddx
extension functionality which will be removed in PHP 7.4 (moved to PECL) in theRemovedExtensions
andRemovedFunctions
sniffs. #826 - ๐ฑ โญ๏ธ New
isShortTernary()
andisUnaryPlusMinus()
utility methods to thePHPCompatibility\Sniff
class. #810, #805
๐ Changed
- ๐ฑ โ๏ธ The
PHPCompatibility.Extensions.RemovedExtensions
sniff will now only report on the removedPayflow Pro
extension when a function usespfpro_
as a prefix. Previously, it used thepfpro
prefix (without underscore) for detection. #812 - ๐ฑ โ๏ธ The error message thrown when the
T_ELLIPSIS
token, i.e. the spread operator, is detected. #803
PHP 7.4 adds a third use-case for the spread operator. The adjusted error message accounts for this. - ๐ฑ โ๏ธ
PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations
is now also tested with parameters using the splat operator. #802 - ๐ The documentation now uses the GitHub repo of
PHP_CodeSniffer
as the canonical entry point forPHP_CodeSniffer
. Previously, it would point to the PEAR package. #788 - ๐ฑ ๐ The links in the changelog now all point to the
PHPCompatibility/PHPCompatibility
repo and no longer to the (deprecated)wimg/PHPCompatibility
repo. #828 - ๐ โป๏ธ Various minor inline documentation improvements. #825
- ๐ ๐ง Various performance optimizations and code simplifications. #783, #784, #795, #813
- ๐ ๐ Travis: build tests are now being run against PHP 7.4 (unstable) as well. #790
๐ Note: the builds are currently not (yet) tested against PHP 8.0 (unstable) as there is no compatible PHPUnit version available (yet). - ๐จ ๐ง Travis: The build script has been refactored to use stages to get the most relevant results faster. Additionally some more tweaks have been made to improve and/or simplify the build script. #798
- ๐ ๐ง Build/PHPCS: warnings are no longer allowed for the PHPCompatibility native code. #800
- ๐ ๐ง Build/PHPCS: added variable assignment alignment check and file include check to the PHPCompatibility native CS configuration. #824
- ๐ฑ ๐ง The minimum version for the recommended
DealerDirect/phpcodesniffer-composer-installer
Composer plugin has been upped to0.5.0
. #791
๐ Fixed
- ๐ฑ ๐ The
PHPCompatibility.Extensions.RemovedExtensions
sniff contained a typo in the alternative recommended for the removedmcve
extension. #806 - ๐ฑ ๐ The
PHPCompatibility.Extensions.RemovedExtensions
sniff listed the wrong removal version number for thePayflow Pro/pfpro
extension (PHP 5.3 instead of the correct 5.1). #823
Credits
๐ฑ Thanks go out to Yฤฑlmaz and Tim Millwood for their contribution to this version. ๐
- ๐ฑ ๐ New
-
v9.1.1 Changes
December 31, 2018๐ See all related issues and PRs in the 9.1.1 milestone.
๐ Fixed
-
v9.1.0 Changes
December 16, 2018๐ See all related issues and PRs in the 9.1.0 milestone.
โ Added
- ๐ New
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue
sniff to detect code which could be affected by the PHP 7.0 change in the values reported byfunc_get_arg()
,func_get_args()
,debug_backtrace()
and exception backtraces. #750. Fixes #585. - ๐ฑ ๐ New
PHPCompatibility.MethodUse.NewDirectCallsToClone
sniff to detect direct call to a__clone()
magic method which wasn't allowed prior to PHP 7.0. #743. Fixes #629. - ๐ฑ ๐ New
PHPCompatibility.Variables.ForbiddenThisUseContext
sniff to detect most of the inconsistencies surrounding the use of the$this
variable, which were removed in PHP 7.1. #762, #771. Fixes #262 and #740. - ๐ฑ โญ๏ธ
NewClasses
: detection of more native PHP Exceptions. #743, #753 - ๐ฑ โญ๏ธ
NewConstants
: detection of the new PHP 7.3 Curl, Stream Crypto and LDAP constants and some more PHP 7.0 Tokenizer constants. #752, #767, #778 - ๐ฑ โญ๏ธ
NewFunctions
sniff: recognize (more) new LDAP functions as introduced in PHP 7.3. #768 - ๐ฑ โญ๏ธ
NewFunctionParameters
sniff: recognize the new$serverctrls
parameter which was added to a number of LDAP functions in PHP 7.3. #769 - โญ๏ธ
NewIniDirectives
sniff: recognize the newimap.enable_insecure_rsh
ini directive as introduced in PHP 7.1.25, 7.2.13 and 7.3.0. #770 - ๐ฑ โญ๏ธ
NewInterfaces
sniff: recognize two more Session related interfaces which were introduced in PHP 5.5.1 and 7.0 respectively. #748 - ๐ฑ โญ๏ธ Duplicate of upstream
findStartOfStatement()
method to thePHPCompatibility\PHPCSHelper
class to allow for PHPCS cross-version usage of that method. #750
๐ Changed
- ๐
๐
RemovedPHP4StyleConstructors
: will now also detect PHP4-style constructors when declared in interfaces. #751 - ๐
Sniff::validDirectScope()
: the return value of this method has changed. Previously it would always be a boolean. It will stil returnfalse
when no valid direct scope has been found, but it will now return thestackPtr
to the scope token if a valid direct scope was encountered. #758 - โช
NewOperators
: updated the version number forT_COALESCE_EQUAL
. #746 - ๐ฑ ๐ Minor improvement to an error message in the unit test suite. #742
- ๐ฑ โป๏ธ Various code clean-up and improvements. #745, #756, #774
- ๐ โป๏ธ Various minor inline documentation fixes. #749, #757
- ๐ฑ โ๏ธ Improved code coverage recording. #744, #776
- ๐ ๐ Travis: build tests are now being run against PHP 7.3 as well. #511
Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
๐ Fixed
- โ
Compatibility with the upcoming release of PHPCS 3.4.0. Deal with changed behaviour of the PHPCS
Tokenizer
regarding binary type casts. #760 - ๐ ๐
InternalInterfaces
: false negative for implemented/extended interfaces prefixed with a namespace separator. #775 - ๐ฑ ๐
NewClasses
: the introduction version of various native PHP Exceptions has been corrected. #743, #753 - ๐ฑ ๐
NewInterfaces
: false negative for implemented/extended interfaces prefixed with a namespace separator. #775 - ๐
๐
RemovedPHP4StyleConstructors
: the sniff would examine methods in nested anonymous classes as if they were methods of the higher level class. #751 - ๐
โช
RemovedPHP4StyleConstructors
: the sniff will no longer throw false positives for the first method in an anonymous class when used in combination with PHPCS 2.3.x. #751 - ๐ฑ โช
ReservedFunctionNames
: fixed incorrect error message text for methods in anonymous classes when used in combination with PHPCS 2.3.x. #755 - ๐ฑ ๐
ReservedFunctionNames
: prevent duplicate errors being thrown for methods in nested anonymous classes. #755 - ๐ฑ ๐
PHPCSHelper::findEndOfStatement()
: minor bug fix. #749 - ๐ฑ ๐
Sniff::isClassProperty()
: class properties for classes nested in conditions or function calls were not always recognized as class properties. #758
Credits
๐ฑ Thanks go out to Jonathan Champ for his contribution to this version. ๐
- ๐ New
-
v9.0.0 Changes
October 07, 2018IMPORTANT : 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
- โก๏ธ If you have
<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. - ๐ If you use the new PHPCS 3.2+ inline annotations, i.e.
// phpcs:ignore Standard.Category.SniffName
, in combination with PHPCompatibility sniff names, you will need to update these annotations. - โฌ๏ธ If you use neither of the above, you should be fine and upgrading should be painless.
Overview of all the sniff renames:
Old Category.SniffName New Category.SniffName PHP.ArgumentFunctionsUsage FunctionUse.ArgumentFunctionsUsage PHP.CaseSensitiveKeywords Keywords.CaseSensitiveKeywords PHP.ConstantArraysUsingConst InitialValue. New ConstantArraysUsingConst PHP.ConstantArraysUsingDefine InitialValue. New ConstantArraysUsingDefine PHP. Deprecated Functions FunctionUse. Removed Functions PHP. Deprecated IniDirectives IniDirectives. Removed IniDirectives PHP. Deprecated MagicAutoload FunctionNameRestrictions. Removed MagicAutoload PHP. Deprecated NewReference Syntax. Removed NewReference PHP. Deprecated PHP4StyleConstructors FunctionNameRestrictions. Removed PHP4StyleConstructors PHP. Deprecated TypeCasts TypeCasts. Removed TypeCasts PHP.DiscouragedSwitchContinue ControlStructures.DiscouragedSwitchContinue PHP.DynamicAccessToStatic Syntax. New DynamicAccessToStatic PHP.EmptyNonVariable LanguageConstructs. New EmptyNonVariable PHP.ForbiddenBreakContinueOutsideLoop ControlStructures.ForbiddenBreakContinueOutsideLoop PHP.ForbiddenBreakContinueVariableArguments ControlStructures.ForbiddenBreakContinueVariableArguments PHP.ForbiddenCallTimePassByReference Syntax.ForbiddenCallTimePassByReference PHP.Forbidden ClosureUseVariableNames FunctionDeclarations.Forbidden VariableNamesInClosureUse PHP.ForbiddenEmptyListAssignment Lists.ForbiddenEmptyListAssignment PHP.Forbidden Function ParametersWithSameName FunctionDeclarations.ForbiddenParametersWithSameName PHP.ForbiddenGlobalVariableVariable Variables.ForbiddenGlobalVariableVariable PHP.ForbiddenNames Keywords.ForbiddenNames PHP.ForbiddenNamesAsDeclared Keywords.ForbiddenNamesAsDeclared PHP.ForbiddenNamesAsInvokedFunctions Keywords.ForbiddenNamesAsInvokedFunctions PHP.ForbiddenNegativeBitshift Operators.ForbiddenNegativeBitshift PHP.ForbiddenSwitchWithMultipleDefaultBlocks ControlStructures.ForbiddenSwitchWithMultipleDefaultBlocks PHP.InternalInterfaces Interfaces.InternalInterfaces PHP.LateStaticBinding Classes. New LateStaticBinding PHP. MbstringReplaceE Modifier ParameterValues. RemovedMbstring Modifier s PHP.NewAnonymousClasses Classes.NewAnonymousClasses PHP.NewArrayStringDereferencing Syntax.NewArrayStringDereferencing PHP.NewClasses Classes.NewClasses PHP.NewClassMemberAccess Syntax.NewClassMemberAccess PHP.NewClosure FunctionDeclarations.NewClosure PHP.NewConstants Constants.NewConstants PHP.NewConstantScalarExpressions InitialValue.NewConstantScalarExpressions PHP.NewConstVisibility Classes.NewConstVisibility PHP.NewExecutionDirectives ControlStructures.NewExecutionDirectives PHP.NewFunctionArrayDereferencing Syntax.NewFunctionArrayDereferencing PHP.NewFunctionParameters FunctionUse.NewFunctionParameters PHP.NewFunctions FunctionUse.NewFunctions PHP.NewGeneratorReturn Generators.NewGeneratorReturn PHP.NewGroupUseDeclarations UseDeclarations.NewGroupUseDeclarations PHP.NewHashAlgorithms ParameterValues.NewHashAlgorithms PHP.NewHeredoc Initialize InitialValue.NewHeredoc PHP.NewIniDirectives IniDirectives.NewIniDirectives PHP.NewInterfaces Interfaces.NewInterfaces PHP.NewKeywords Keywords.NewKeywords PHP.NewLanguageConstructs LanguageConstructs.NewLanguageConstructs PHP.NewMagicClassConstant Constants.NewMagicClassConstant PHP.NewMagicMethods FunctionNameRestrictions.NewMagicMethods PHP.NewMultiCatch ControlStructures.NewMultiCatch PHP.NewNullableTypes FunctionDeclarations.NewNullableTypes PHP.NewReturnTypeDeclarations FunctionDeclarations.NewReturnTypeDeclarations PHP.New Scalar TypeDeclarations FunctionDeclarations.New Param TypeDeclarations PHP.NewTrailingComma Syntax.New FunctionCall TrailingComma PHP.NewTypeCasts TypeCasts.NewTypeCasts PHP.NewUseConstFunction UseDeclarations.NewUseConstFunction PHP.NonStaticMagicMethods FunctionDeclarations.NonStaticMagicMethods PHP.OptionalRequiredFunctionParameters FunctionUse.Optional To RequiredFunctionParameters PHP.ParameterShadowSuperGlobals FunctionDeclarations. Forbidden ParameterShadowSuperGlobals PHP. PCRENew Modifiers ParameterValues. NewPCRE Modifiers PHP. PregReplaceE Modifier ParameterValues. RemovedPCRE Modifier s PHP.RemovedAlternativePHPTags Miscellaneous.RemovedAlternativePHPTags PHP.RemovedConstants Constants.RemovedConstants PHP.RemovedExtensions Extensions.RemovedExtensions PHP.RemovedFunctionParameters FunctionUse.RemovedFunctionParameters PHP.RemovedGlobalVariables Variables.Removed Predefined GlobalVariables PHP.RemovedHashAlgorithms ParameterValues.RemovedHashAlgorithms PHP.ReservedFunctionNames FunctionNameRestrictions.ReservedFunctionNames PHP.RequiredOptionalFunctionParameters FunctionUse.Required To OptionalFunctionParameters PHP.ShortArray Syntax. New ShortArray PHP.Ternary Operators Operators. NewShort Ternary PHP.ValidIntegers Miscellaneous.ValidIntegers PHP. VariableVariables Variables. NewUniformVariableSyntax ๐ Changelog for version 9.0.0
๐ See all related issues and PRs in the 9.0.0 milestone.
โ Added
- ๐ฑ ๐ New
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. #664 - ๐ฑ ๐ New
PHPCompatibility.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. #657 - ๐ฑ ๐ New
PHPCompatibility.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. - ๐ฑ ๐ New
PHPCompatibility.Lists.AssignmentOrder
sniff to detectlist()
constructs affected by the change in assignment order in PHP 7.0. #656 - ๐ฑ ๐ New
PHPCompatibility.Lists.NewKeyedList
sniff to detect usage of keys inlist()
, support for which was added in PHP 7.1. #655. Fixes #252. - ๐ฑ ๐ New
PHPCompatibility.Lists.NewListReferenceAssignment
sniff to detect reference assignments being used inlist()
constructs, support for which has been added in PHP 7.3. #731 - ๐ฑ ๐ New
PHPCompatibility.Lists.NewShortList
sniff to detect the shorthand array syntax[]
being used for symmetric array destructuring as introduced in PHP 7.1. #654. Fixes #248. - ๐ฑ ๐ New
PHPCompatibility.Operators.NewOperators
sniff which checks for usage of the pow, pow equals, spaceship and coalesce (equals) operators. #738
These checks were previously contained within thePHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff. - ๐ฑ ๐ New
PHPCompatibility.ParameterValues.ForbiddenGetClassNull
sniff to detectnull
being passed toget_class()
, support for which has been removed in PHP 7.2 #659. Fixes #557. - ๐ฑ ๐ New
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 #649 - ๐ฑ ๐ New
PHPCompatibility.ParameterValues.NewFopenModes
sniff to examine the$mode
parameter passed tofopen()
for modes not available in older PHP versions. #658 - ๐ฑ ๐ New
PHPCompatibility.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. - ๐ฑ ๐ New
PHPCompatibility.ParameterValues.NewPackFormats
sniff to examine the$format
parameter passed topack()
for formats not available in older PHP versions. #665 - ๐ New
PHPCompatibility.ParameterValues.RemovedIconvEncoding
sniff to detect the PHP 5.6 deprecated encoding$type
s being passed toiconv_set_encoding()
. #660. Fixes #475. - ๐ฑ ๐ New
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 #559 - ๐ฑ ๐ New
PHPCompatibility.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. #661 - ๐ฑ ๐ New
PHPCompatibility.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. #676 - ๐ฑ โญ๏ธ
PHPCompatibility.Constants.NewConstants
sniff: recognize new constants which are being introduced in PHP 7.3. #678 - ๐ฑ โญ๏ธ
PHPCompatibility.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. #679 - ๐ โญ๏ธ
PHPCompatibility.FunctionUse.NewFunctions
sniff: recognize thesapi_windows_*()
,hash_hkdf()
andpcntl_signal_get_handler()
functions as introduced in PHP 7.1. #728 - ๐ฑ โญ๏ธ
PHPCompatibility.FunctionUse.RemovedFunctionParameters
sniff: recognize the deprecation of the$case_insensitive
parameter for thedefine()
function in PHP 7.3. #706 - ๐ฑ โญ๏ธ
PHPCompatibility.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. #680 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.NewIniDirectives
sniff: recognize newsyslog
andsession
ini directives as introduced in PHP 7.3. #702, #719, #730 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.NewIniDirectives
sniff: recognize some more ini directives which were introduced in PHP 7.1. #727 - ๐ฑ โญ๏ธ
PHPCompatibility.IniDirectives.RemovedIniDirectived
sniff: recognize ini directives removed in PHP 7.3. #677, #717. Partially fixes #718. - ๐ฑ โญ๏ธ New
isNumericCalculation()
andisVariable()
utility methods to thePHPCompatibility\Sniff
class. #664, #666 - ๐ฑ ๐ A section about the new sniff naming conventions to the
Contributing
file. #738
๐ Changed
- ๐ฑ ๐ฅ 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. #738. Fixes #601, #692
๐ See the table at the top of this changelog for details of all the file renames. - ๐ฑ โ๏ธ The unit test files have been moved about as well. #738
- The directory structure for these now mirrors the default directory structure used by PHPCS itself.
- The file names of the unit test files have been adjusted for the changes made in the sniffs.
- The unit test case files have been renamed and moved to the same directory as the actual test file they apply to.
- The
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. - The unit tests for the utility methods in the
PHPCompatibility\Sniff
class have been moved to a newPHPCompatibility\Util\Tests\Core
subdirectory. - The bootstrap file used for PHPUnit has been moved to the project root directory and renamed
phpunit-bootstrap.php
.
- ๐ The
PHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff has been split into two sniffs. #738
ThePHPCompatibility.LanguageConstructs.NewLanguageConstructs
sniff now contains just the checks for the namespace separator and the ellipsis.
The newPHPCompatibility.Operators.NewOperators
sniff now contains the checks regarding the pow, pow equals, spaceship and coalesce (equals) operators. - ๐ฑ ๐ The
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. #715 - ๐ฑ ๐ The
PHPCompatibility\Sniff::getFunctionCallParameter()
utility method now allows for closures called via a variable. #723 - โฌ๏ธ โ๏ธ
PHPCompatibility.Upgrade.LowPHPCS
: the minimum supported PHPCS version is now 2.3.0. #699 - ๐ โ๏ธ Minor inline documentation improvements. #738
- ๐ฑ โ๏ธ Minor improvements to the unit tests for the
PHPCompatibility.FunctionNameRestrctions.RemovedMagicAutoload
sniff. #716 - ๐ฑ โป๏ธ Minor other optimizations. #698, #697
- ๐ ๐ง Minor improvements to the build tools. #701
- ๐ฑ ๐ง Removed some unnecessary inline annotations. #700
- ๐ฑ ๐ Replaced some of the badges in the Readme file. #721, #722
- โก๏ธ ๐ Composer: updated the list of package authors. #739
โ Removed
- ๐ซ Support for PHP_CodeSniffer 1.x and low 2.x versions. The new minimum version of PHP_CodeSniffer to be able to use this library is 2.3.0. #699. Fixes #691.
The minimum recommended version of PHP_CodeSniffer remains the same, i.e. 2.6.0. - ๐ซ The
\PHPCompatibility\Sniff::inUseScope()
method has been removed as it is no longer needed now support for PHPCS 1.x has been dropped. #699 - ๐ซ Composer: The
autoload
section has been removed from thecomposer.json
file. #738. Fixes #568.
0๏ธโฃ 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. #707 - ๐ฑ ๐ Various bugs in the
PHPCompatibility.Syntax.ForbiddenCallTimePassByReference
sniff #723:- Closures called via a variable will now also be examined. (false negative)
- References within arrays/closures passed as function call parameters would incorrectly trigger an error. (false positive)
- ๐ฑ ๐ Compatibility with PHPUnit 7.2. #712
Credits
๐ฑ Thanks go out to Jonathan Champ for his contribution to this version. ๐
- โก๏ธ If you have