Changelog History
Page 2
-
v8.2.0 Changes
July 17, 2018Important changes
๐ The repository has moved
๐ As of July 13 2018, the PHPCompatibility repository has moved from the personal account of Wim Godden
wimg
to its own organizationPHPCompatibility
.
โก๏ธ Composer users are advised to update theircomposer.json
. The dependency is now calledphpcompatibility/php-compatibility
.Framework/CMS specific PHPCompatibility rulesets
Within this new organization, hosting will be offered for framework/CMS specific PHPCompatibility rulesets.
The first two such repositories have been created and are now available for use:
๐ฆ If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the PHPCompatibilityAll package GitHub|Packagist.
๐ For more information, see the Readme and Contributing guidelines.
๐ Changes expected in PHPCompatibility 9.0.0
The next version of PHPCompatibility will include a major directory layout restructuring which means that the sniff codes of all sniffs will change.
๐ In this same release, support for PHP_CodeSniffer 1.5.x will be dropped. The new minimum supported PHPCS version will be 2.3.0.
For more information about these upcoming changes, please read the announcement.
๐ The
9.0.0
release is expected to be ready later this summer.
๐ See all related issues and PRs in the [8.2.0 milestone].
โ Added
- ๐ New
ArgumentFunctionsUsage
sniff to detect usage of thefunc_get_args()
,func_get_arg()
andfunc_num_args()
functions and the changes regarding these functions introduced in PHP 5.3. #596. Fixes #372. - ๐ฑ ๐ New
DiscouragedSwitchContinue
sniff to detectcontinue
targetting aswitch
control structure for whichE_WARNINGS
will be thrown as of PHP 7.3. #687 - ๐ฑ ๐ New
NewClassMemberAccess
sniff to detect class member access on instantiation as added in PHP 5.4 and class member access on cloning as added in PHP 7.0. #619. Fixes #53. - ๐ฑ ๐ New
NewConstantScalarExpressions
sniff to detect PHP 5.6 scalar expression in contexts where PHP previously only allowed static values. #617. Fixes #399. - ๐ฑ ๐ New
NewGeneratorReturn
sniff to detectreturn
statements within generators as introduced in PHP 7.0. #618 - ๐ฑ ๐ New
PCRENewModifiers
sniff to initially detect the newJ
regex modifier as introduced in PHP 7.2. #600. Fixes #556. - ๐ฑ ๐ New
ReservedFunctionNames
sniff to report on double underscore prefixed functions and methods. This was previously reported via an upstream sniff. #581 - ๐ฑ ๐ New
NewTrailingComma
sniff to detect trailing comma's in function calls, method calls,isset()
andunset()
as will be introduced in PHP 7.3. #632 - โฌ๏ธ ๐ New
Upgrade/LowPHPCS
sniff to give users of old PHP_CodeSniffer versions advance warning when support will be dropped in the near future. #693 - ๐ฑ โญ๏ธ
NewClasses
sniff: check for some 40+ additional PHP native classes added in various PHP versions. #573 - ๐ฑ โญ๏ธ
NewClosure
sniff: check for usage ofself
/parent
/static::
being used within closures, support for which was only added in PHP 5.4. #669. Fixes #668. - ๐ฑ โญ๏ธ
NewConstants
sniff: recognize constants added by the PHP 5.5+ password extension. #626 - ๐ฑ โญ๏ธ
NewFunctionParameters
sniff: recognize a number of additional function parameters added in PHP 7.0, 7.1 and 7.2. #602 - โญ๏ธ
NewFunctions
sniff: recognize the PHP 5.1 SPL extension functions, the PHP 5.1.1hash_hmac()
function, the PHP 5.6pg_lo_truncate()
function, more PHP 7.2 Sodium functions and the new PHP 7.3is_countable()
function. #606, #625, #640, #651 - ๐ฑ โญ๏ธ
NewHashAlgorithms
sniff: recognize the new hash algorithms which were added in PHP 7.1. #599 - ๐ฑ โญ๏ธ
NewInterfaces
sniff: check for the PHP 5.0Reflector
interface. #572 - ๐ฑ โญ๏ธ
OptionalRequiredFunctionParameters
sniff: detect missing$salt
parameter in calls to thecrypt()
function (PHP 5.6+). #605 - ๐ฑ โญ๏ธ
RequiredOptionalFunctionParameters
sniff: recognize that the$varname
parameter ofgetenv()
and the$scale
parameter ofbcscale()
have become optional as of PHP 7.1 and 7.3 respectively. #598, #612 - ๐ฑ โญ๏ธ New
AbstractFunctionCallParameterSniff
to be used as a basis for sniffs examining function call parameters. #636 - ๐ฑ โญ๏ธ New
getReturnTypeHintName()
utility method to thePHPCompatibility\Sniff
class. #578, #642 - ๐ฑ โญ๏ธ New
isNumber()
,isPositiveNumber()
andisNegativeNumber()
utility methods to thePHPCompatibility\Sniff
class. #610, #650 - ๐ฑ โญ๏ธ New
isShortList()
utility method to thePHPCompatibility\Sniff
class. #635 - ๐ฑ โญ๏ธ New
getCommandLineData()
method to thePHPCompatibility\PHPCSHelper
class to provide PHPCS cross-version compatible access to command line info at run time. #693 - ๐ฑ โญ๏ธ Duplicate of upstream
findEndOfStatement()
method to thePHPCompatibility\PHPCSHelper
class to allow for PHPCS cross-version usage of that method. #614 - ๐ฑ โ๏ธ additional unit test to confirm that the
PHPCompatibility\Sniff::isUseOfGlobalConstant()
method handles multi-constant declarations correctly. #587 - ๐ฑ โ๏ธ additional unit tests to confirm that the
PHPCompatibility\Sniff::isClassProperty()
method handles multi-property declarations correctly. #583 - ๐ฑ ๐ Readme & Contributing: add information about the framework/CMS specific rulesets. Related PRs: #615, #624, #648, #674, #685, #694. Related to issue #530.
- ๐ฑ ๐ Readme: information about the PHPCS 3.3.0 change which allows for a
testVersion
in a custom ruleset to be overruled by the command-line. #607
๐ Changed
- ๐ฑ ๐ Adjusted references to the old repository location throughout the codebase to reflect the move to a GitHub organization. #689
This repository will now live in https://github.com/PHPCompatibility/PHPCompatibility and the Packagist reference will now bephpcompatibility/php-compatibility
. - โ
The
getReturnTypeHintToken()
utility method has been made compatible with the changes in the PHPCS tokenizer which were introduced in PHP_CodeSniffer 3.3.0. #642. Fixes #639. - ๐ฑ ๐
ConstantArrayUsingConst
: improved handling of multi-constant declarations. #593 - ๐ฑ ๐
NewHeredocInitialize
: improved handling of constant declarations using theconst
keyword.
0๏ธโฃ The sniff will now also report on multi-declarations for variables, constants and class properties and on using heredoc as a function parameter default. #641 - ๐ฑ ๐
ForbiddenEmptyListAssignment
: this sniff will now also report on empty list assignments when the PHP 7.1 short list syntax is used. #653 - ๐ฑ ๐ The
ForbiddenNegativeBitshift
sniff would previously only report on "bitshift right". As of this version, "bitshift left" and bitshift assignments will also be recognized. #614 - ๐ The
NewClasses
andNewInterfaces
sniffs will now also report on new classes/interfaces when used as return type declarations. #578 - ๐ฑ ๐ The
NewScalarTypeDeclarations
sniff will now recognizeparent
as a valid type declaration.
๐ The sniff will now also throw an error about usingself
andparent
when PHP < 5.2 needs to be supported as PHP 5.1 and lower would presume these to be class names instead of keywords. #595 - ๐ The
PregReplaceEModifier
sniff - and thePCRENewModifiers
sniff by extension - will now correctly examine and report on modifiers in regexes passed via calls topreg_replace_callback_array()
. #600, #636 - ๐ฑ ๐
getReturnTypeHintToken()
utility method: improved support for interface methods and abstract function declarations. #652 - ๐ฑ ๐ The
findExtendedClassName()
,findImplementedInterfaceNames()
,getMethodParameters()
utility methods which are duplicates of upstream PHPCS methods, have been moved from thePHPCompatibility\Sniff
class to thePHPCompatibility\PHPCSHelper
class and have become static methods. #613 - โ
getReturnTypeHintToken()
utility method: align returned$stackPtr
with native PHPCS behaviour by returning the last token of the type declaration. #575 - โ
PHPCS cross-version compatibility: sync
getMethodParameters()
method with improved upstream version. #643 - ๐ฑ โ๏ธ The
MbstringReplaceEModifier
,PregReplaceEModifier
and thePregReplaceEModifier
sniffs nowextend
the newAbstractFunctionCallParameterSniff
class. This should yield more accurate results when checking whether one of the target PHP functions was called. #636 - โก๏ธ โ๏ธ
DeprecatedNewReference
sniff: minor change to the error text and code - wasForbidden
, nowRemoved
-. Custom rulesets which explicitly excluded this error code will need to be updated. #594 - ๐ฑ โ๏ธ
NewScalarTypeDeclarations
sniff: minor change to the error message text.#644 - ๐ฑ โ๏ธ The unit test framework now allows for sniffs in categories other than
PHP
. #634 - ๐ฑ โ๏ธ Boyscouting: fixed up some (non-relevant) parse errors in a unit test case file. #576
- ๐ ๐ Travis: build tests are now also being run against the lowest supported PHPCS 3.x version. Previously only the highest supported PHPCS 3.x version was tested against. #633
- ๐ฑ ๐ Readme: Improved Composer install instructions. #690
- ๐ ๐ Minor documentation fixes. #672
- ๐ ๐ง Minor performance optimizations and code simplifications. #592, #630, #671
- ๐ ๐ง Composer: Various improvements, including improved information about the suggested packages, suggesting
roave/security-advisories
, allowing for PHPUnit 7.x. #604, #616, #622, #646 - ๐ ๐ง Various Travis build script improvements, including tweaks for faster build time, validation of the
composer.json
file, validation of the framework specific rulesets. #570, #571, #579, #621, #631 - ๐ ๐ง Build/PHPCS: made some more CS conventions explicit and start using PHPCS 3.x options for the PHPCompatibility native ruleset. #586, #667, #673
- ๐ ๐ง Some code style clean up and start using the new inline PHPCS 3.2+ annotations where applicable. #586, #591, #620, #673
โ Removed
- ๐ซ PHPCompatibility no longer explicitly supports PHP_CodeSniffer 2.2.0. #687, #690
- ๐ซ The PHPCompatibility ruleset no longer includes the PHPCS native
Generic.NamingConventions.CamelCapsFunctionName
. Double underscore prefixed function names are now being reported on by a new dedicated sniff. #581 - ๐ซ PHPCompatibility no longer explicitly supports HHVM and builds are no longer tested against HHVM.
โ For now, running PHPCompatibility on HHVM to test PHP code may still work for a little while, but HHVM has announced they are dropping PHP support. #623. Fixes #603. - ๐ฑ ๐ Readme: badges from services which are no longer supported or inaccurate. #609, #628
๐ Fixed
- ๐ฑ ๐ Previously, the PHPCS native
Generic.NamingConventions.CamelCapsFunctionName
sniff was included in PHPCompatibility. Some error codes of this sniff were excluded, as well as some error messages changed (via the ruleset).
๐ If/when PHPCompatibility would be used in combination with a code style-type ruleset, this could inadvertently lead to underreporting of issues which the CS-type ruleset intends to have reported - i.e. the error codes excluded by PHPCompatibility -. This has now been fixed. #581 - ๐ฑ ๐ The
ForbiddenNegativeBitshift
sniff would incorrectly throw an error when a bitshift was based on a calculation which included a negative number, but would not necessarily result in a negative number. #614. Fixes #294, #466. - ๐ฑ ๐ The
NewClosure
sniff would report the same issue twice when the issue was encountered in a nested closure. #669 - ๐ฑ ๐ The
NewKeywords
sniff would underreport on non-lowercase keywords. #627 - ๐ฑ ๐ The
NewKeywords
sniff would incorrectly report on the use of class constants and class properties using the same name as a keyword. #627 - ๐ฑ ๐ The
NewNullableTypes
sniff would potentially underreport when comments where interspersed in the (return) type declarations. #577 - ๐ฑ ๐ The
Sniff::getFunctionCallParameters()
utility method would in rare cases return incorrect results when it encountered a closure as a parameter. #682 - ๐ฑ ๐ The
Sniff::getReturnTypeHintToken()
utility method would not always return a$stackPtr
. #645 - ๐ ๐ Minor miscellanous other bugfixes. #670
- ๐ฑ โ๏ธ
PHPCompatibility\Tests\BaseClass\MethodTestFrame::getTargetToken()
could potentially not find the correct token to run a test against. #588
Credits
๐ฑ Thanks go out to Michael Babker and Juliette Reinders Folmer for their contributions to this version. ๐
- ๐ New
-
v8.1.0 Changes
December 27, 2017๐ See all related issues and PRs in the 8.1.0 milestone.
โ Added
- ๐ฑ ๐ New
NewConstants
andRemovedConstants
sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. #526, #551, #566. Fixes #263. - ๐ฑ ๐ New
MagicAutoloadDeprecation
sniff to detect deprecated__autoload()
functions as deprecated in PHP 7.2. #540 - ๐ฑ ๐ New
OptionalRequiredFunctionParameter
sniff to check for missing function call parameters which were required and only became optional in a later PHP version. #524 - ๐ฑ ๐ New
DynamicAccessToStatic
sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. #535. Fixes #534. - ๐ฑ โญ๏ธ
DeprecatedFunctions
sniff: recognize yet more PHP 7.2 deprecated functions. #561, #566 - ๐ฑ โญ๏ธ
DeprecatedIniDirectives
sniff: recognize the last of the PHP 7.2 deprecated ini directives. #566, #567 - ๐ฑ โญ๏ธ
NewFunctions
: detection of all new PHP 7.2 functions added. #522, #545, #551, #565 - ๐ฑ โญ๏ธ
RemovedExtensions
: report on usage of themcrypt
extension which has been removed in PHP 7.2. #566 - โญ๏ธ
RemovedGlobalVariables
: detection of the use of$php_errormsg
withtrack_errors
which has been deprecated in PHP 7.2. #528 - ๐ ๐ Documentation : added reporting usage instructions. #533, #552
๐ Changed
- โฌ๏ธ ๐
NewClosures
: downgraded "$this found in closure outside class" to warning. #536. Fixes #527. - ๐ฑ ๐
ForbiddenGlobalVariableVariable
: the sniff will now throw an error for each variable in aglobal
statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown perglobal
statement. #564 - ๐ฑ ๐
ForbiddenGlobalVariableVariable
: the sniff will now throwwarning
s for non-bare variables used in aglobal
statement as those are discouraged since PHP 7.0. #564 - โช
NewLanguageConstructs
: updated the version number forT_COALESCE_EQUAL
. #523 - ๐ฑ โ๏ธ
Sniff::getTestVersion()
: simplified regex logic. #520 - ๐ ๐ Travis : build tests are now being run against PHP 7.2 as well. #511
- ๐ฑ ๐ง Improved check for superfluous whitespaces in files. #542
- ๐ ๐ง Build/PHPCS : stabilized the exclude patterns. #529
- ๐ ๐ง Build/PHPCS : added array indentation check. #538
- โ
PHPCS cross-version compatibility : sync
FindExtendedClassname()
method with upstream. #507 - ๐ฑ ๐ง The minimum version for the recommended
DealerDirect/phpcodesniffer-composer-installer
Composer plugin has been upped to0.4.3
. #548
๐ Fixed
- ๐
ForbiddenCallTimePassByReference
: a false positive was being thrown when a global constant was followed by a bitwise and. #562. Fixes #39. - ๐ฑ ๐
ForbiddenGlobalVariableVariable
: the sniff was overzealous and would also report onglobal
in combination with variable variables which are still supported. #564. Fixes #537. - ๐ฑ ๐
ForbiddenGlobalVariableVariable
: variables interspersed with whitespace and/or comments were not being reported. #564 - ๐ฑ โช
ForbiddenNamesAsInvokedFunctions
: improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. #516. Fixes #515 - ๐ฑ ๐
VariableVariables
: variables interspersed with whitespace and/or comments were not being reported. #563 - ๐ฑ โ๏ธ Fixed some unintentional syntax errors in test files. #539
- ๐ฑ โ๏ธ Tests : fixed case numbering error. #525
- ๐ฑ ๐ Tests : added missing test skip explanation. #521
- ๐ฑ ๐ง Fixed PHPCS whitespaces. #543
- ๐ฑ ๐ง Fixed code test coverage verification. #550. Fixes #549.
Credits
๐ฑ Thanks go out to Juliette Reinders Folmer and Jonathan Van Belle for their contributions to this version. ๐
- ๐ฑ ๐ New
-
v8.0.1 Changes
August 07, 2017๐ See all related issues and PRs in the 8.0.1 milestone.
โ Added
- ๐ฑ ๐ New
DeprecatedTypeCasts
sniff to detect deprecated and removed type casts, such as the(unset)
type cast as deprecated in PHP 7.2. #498 - ๐ฑ ๐ New
NewTypeCasts
sniff to detect type casts not present in older PHP versions such as the(binary)
type cast as added in PHP 5.2.1. #497 - ๐ฑ โญ๏ธ
NewGroupUseDeclaration
: Detection of PHP 7.2 trailing comma's in group use statements. #504 - ๐ฑ โญ๏ธ
DeprecatedFunctions
sniff: recognize some more PHP 7.2 deprecated functions. #501 - ๐ฑ โญ๏ธ
DeprecatedIniDirectives
sniff: recognize more PHP 7.2 deprecated ini directives. #500 - ๐ฑ โญ๏ธ
ForbiddenNames
sniff: recognizeobject
as a forbidden keyword since PHP 7.2. #499 - ๐ฑ โญ๏ธ
NewReturnTypeDeclarations
sniff: recognize genericparent
, PHP 7.1iterable
and PHP 7.2object
return type declarations. #505, #499 - ๐ฑ โญ๏ธ
NewScalarTypeDeclarations
sniff: recognize PHP 7.2object
type declarion. #499
๐ Changed
๐ฑ โ๏ธ Improved clarity of the deprecated functions alternative in the error message. #502
๐ Fixed
๐ ๐ Temporary hotfix for installed_paths (pending upstream fix.) #503
Credits
๐ฑ Thanks go out to Juliette Reinders Folmer for her contributions to this version. ๐
- ๐ฑ ๐ New
-
v8.0.0 Changes
August 02, 2017๐ Version 8.0.0 - 2017-08-03
IMPORTANT : This release contains a breaking change. Please read the below information carefully before upgrading!
The directory layout of the PHPCompatibility standard has been changed for improved compatibility with Composer.
This means that the PHPCompatibility standard no longer extends from the root directory of the repository, but now lives in its own subdirectory/PHPCompatibility
.๐ This release also bring compatibility with PHPCS 3.x to the PHPCompatibility standard.
There are two things you will need to be aware of:
- The path to the PHPCompatibility standard has changed.
- โฌ๏ธ If you intend to upgrade to PHPCS 3.x, the path to the
phpcs
script has changed (upstream change).
โฌ๏ธ Please follow the below upgrade instructions carefully. This should be a one-time only action.
โฌ๏ธ Upgrade instructions
โฌ๏ธ Before upgrading
If you had previously made accommodations for the old directory layout, you should remove any such "hacks" (meant in the kindest of ways) now.
๐ By this we mean: symlinks for the PHPCompatibility install to the
PHP_CodeSniffer/CodeSniffer/Standards
directory, scripts to move the sniffs files to the PHPCS directory, scripts which made symlinks etc.๐ So, please remove those first.
Side-note :
โช > If you had previously forked this repository to solve this issue, please consider reverting your fork to the official version or removing it all together.
โฌ๏ธ Upgrading: re-registering PHPCompatibility with PHP CodeSniffer
๐ External PHP CodeSniffer standards need to be registered with PHP CodeSniffer. You have probably done this the first time you used PHPCompatibility or have a script or Composer plugin in place to do this for you.
As the directory layout of PHPCompatibility has changed, the path previously registered with PHP CodeSniffer will no longer work and running
phpcs -i
will not list PHPCompatibility as one of the registered standards.๐ Using a Composer plugin
๐ If you use Composer, we recommend you use a Composer plugin to sort this out. In previous install instructions we recommended the SimplyAdmin plugin for this. This plugin has since been abandoned. We now recommend the DealerDirect plugin.
composer remove --dev simplyadmire/composer-plugins composer require --dev dealerdirect/phpcodesniffer-composer-installer:^0.4.1 composer install composer update wimg/php-compatibility squizlabs/php\_codesniffer vendor/bin/phpcs -i
๐ If all went well, you should now see PHPCompatibility listed again in the list of installed standards.
Manually re-registering PHPCompatibility
First run
phpcs --config-show
to check which path(s) are currently registered with PHP CodeSniffer for external standards.Check in the below table what the new path for PHPCompatibility will be - the path should point to the root directory of your PHPCompatibility install (not to the sub-directory of the same name):
Install type Old path New path Composer vendor/wimg
vendor/wimg/php-compatibility
๐ Unzipped release to arbitrary directory path/to/dir/abovePHPCompatibility
Git checkout path/to/dir/abovePHPCompatibility
path/to/dir/abovePHPCompatibility/PHPCompatibility
PEAR If the old install instruction has been followed, not registered. path/to/PHPCompatibility
Side-note :
๐ > If you used the old install instructions for a PEAR install, i.e. checking out the latest release to the
PHP/CodeSniffer/Standards/PHPCompatibility
directory, and you intend to upgrade to PHP CodeSniffer 3.x, it is recommended you move the PHPCompatibility folder out of the PEAR directory now, as the layout of the PHPCS directory has changed with PHPCS 3.x and you may otherwise lose your PHPCompatibility install when you upgrade PHP CodeSniffer via PEAR.There are two ways in which you can register the new
installed_paths
value with PHP CodeSniffer. Choose your preferred method:Run
phpcs --config-set installed_paths ...
and include all previously installed paths including the adjusted path for the PHPCompatibility standard.For example, if the previous value of
installed_paths
was/path/to/MyStandard,/path/to/dir/abovePHPCompatibility
you should now set it using
phpcs --config-set installed_paths /path/to/MyStandard,/path/to/PHPCompatibility
If you use a custom ruleset in combination with PHPCS 2.6.0 or higher, you can pass the value to PHPCS from your custom ruleset:
\<config name="installed\_paths" value="vendor/wimg/php-compatibility" /\>
โ Run
phpcs -i
to verify that the PHPCompatibility standard is now listed again in the list of installed standards.โฌ๏ธ Upgrading to PHPCS 3.x
The path to the
phpcs
script has changed in PHPCS 3.x which will impact how you call PHPCS.Version PHPCS 2.x PHPCS 3.x Generic phpcs
Commandpath/to/PHP_CodeSniffer/scripts/phpcs ....
path/to/PHP_CodeSniffer/bin/phpcs ....
Composer command vendor/bin/phpcs ...
vendor/bin/phpcs ...
๐ So, for Composer users, nothing changes. For everyone else, you may want to add the
path/to/PHP_CodeSniffer/bin/phpcs
path to your PATH environment variable or adjust any scripts - like build scripts - which call PHPCS.โฌ๏ธ Upgrading a Travis build script
๐ If you run PHPCompatibility against your code as part of your Travis build:
- ๐ If you use Composer to install PHP CodeSniffer and PHPCompatibility on the travis image and you've made the above mentioned changes, your build should pass again.
- ๐ If you use
git clone
to install PHP CodeSniffer and PHPCompatibility on the travis image, your build will fail until you make the following changes:- Check which branch of PHPCS is being checked out. If you previously fixed this to a pre-PHPCS 3.x branch or tag, you can now change this (back) to
master
or a PHPCS 3 tag. - Check to which path PHPCompatibility is being cloned and adjust the path if necessary.
- Adjust the
phpcs --config-set installed_paths
command as described above to point to the root of the cloned PHPCompatibility repo. - If you switched to using PHPCS 3.x, adjust the call to PHPCS.
- Check which branch of PHPCS is being checked out. If you previously fixed this to a pre-PHPCS 3.x branch or tag, you can now change this (back) to
๐ Changelog for version 8.0.0
๐ See all related issues and PRs in the 8.0 milestone.
โ Added
๐ Changed
- ๐ฑ ๐ As of this version PHPCompatibility will use semantic versioning.
- ๐ฑ ๐ฅ The directory structure of the repository has changed for better compatibility with installation via Composer. #446. Fixes #102, #107
- ๐ฑ โ๏ธ The custom
functionWhitelist
property for thePHPCompatibility.PHP.RemovedExtensions
sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). #482 - ๐ฑ ๐ง Improved the information provided to Composer from the
composer.json
file. #446, #482, #486 - ๐ ๐ง Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with
--prefer-source
or by checking out a git clone of the repository. #494 - ๐ ๐ง A variety of minor improvements to the build process. #485, #486, #487
- ๐ฑ ๐ง Some files for use by contributors have been renamed to use
.dist
extensions or moved for easier access. #478, #479, #483, #493 - ๐ฑ ๐ The installation instructions in the Readme. #496
- ๐ฑ ๐ The unit test instructions in the Contributing file. #496
- ๐ฑ ๐ Improved the example code in the Readme. #490
โ Removed
๐ซ Support for PHP 5.1 and 5.2.
The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. #484, #482
Credits
๐ฑ Thanks go out to Gary Jones and Juliette Reinders Folmer for their contributions to this version. ๐
-
v7.1.5 Changes
July 16, 2017โ Added
๐ฑ โญ๏ธ The NewKeywords sniff will now also sniff for yield from which was introduced in PHP 7.0. #477. Fixes #476
๐ฑ ๐ The LGPL-3.0 license. #447๐ Changed
๐ฑ โช The NewExecutionDirectives sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. #451
๐ฑ โช The getMethodParameters() utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. #452
๐ฑ โช The inUseScope() utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. #454
๐ โป๏ธ Various (minor) refactoring for improved performance and sniff accuracy. #443, #474
๐ฑ โ๏ธ Renamed a test file for consistency. #453
๐ ๐ง Code style clean up. #429
๐ฑ ๐ง Prevent Composer installing PHPCS 3.x. PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future. #444
๐ ๐ The code base will now be checked for consistent code style during build testing. #429
๐ฑ ๐ The sniffs are now also tested against HHVM for consistent results. Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time. #450
๐ฑ ๐ Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. #444
๐ฑ ๐ Minor improvements to the Readme. #448, #449, #468
๐ฑ ๐ Minor improvements to the Contributing guidelines. #467โ Removed
๐ซ The DefaultTimeZoneRequired sniff. This sniff was checking server settings rather than code. #458. Fixes #457
๐ซ The NewMagicClassConstant sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. #442. Fixes #436๐ Fixed
๐ฑ ๐ NewClass sniff: was reporting an incorrect introduction version number for a few of the Exception classes. #441. Fixes #440.
๐ฑ ๐ ForbiddenBreakContinueVariableArguments sniff: was incorrectly reporting an error if the break or continue was followed by a PHP closing tag (breaking out of PHP). #462. Fixes #460
๐ฑ ๐ ForbiddenGlobalVariableVariable sniff: was incorrectly reporting an error if the global statement was followed by a PHP closing tag (breaking out of PHP). #463.
๐ฑ ๐ DeprecatedFunctions sniff: was reporting false positives for classes using the same name as a deprecated function. #465. Fixes #464Credits
๐ฑ Thanks go out to Juliette Reinders Folmer and Mark Clements for their contributions to this version. ๐
-
v7.1.4 Changes
May 06, 2017โ Added
- ๐ฑ ๐ New
CaseSensitiveKeywords
sniff to detect use of non-lowercaseself
,static
andparent
keywords which could cause compatibility issues pre-PHP 5.5. #382 - ๐ฑ ๐ New
ConstantArraysUsingConst
sniff to detect constants defined using theconst
keyword being assigned an array value which was not supported prior to PHP 5.6. #397 - ๐ฑ ๐ New
ForbiddenClosureUseVariableNames
sniff to detect PHP 7.1 forbidden variable names in closure use statements. #386. Fixes #374 - ๐ฑ ๐ New
NewArrayStringDereferencing
sniff to detect array and string literal dereferencing as introduced in PHP 5.5. #388 - ๐ฑ ๐ New
NewHeredocInitialize
sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. #391. Fixes #51 - ๐ฑ ๐ New
NewMagicClassConstant
sniff to detect use of the magic::class
constant as introduced in PHP 5.5. #403. Fixes #364. - ๐ฑ ๐ New
NewUseConstFunction
sniff to detect use statements importing constants and functions as introduced in PHP 5.6. #401 - ๐ฑ โญ๏ธ
DeprecatedFunctions
sniff: recognize PHP 7.2 deprecated GD functions. #392 - ๐ฑ โญ๏ธ
DeprecatedIniDirectives
sniff: recognize PHP 7.2 deprecatedmbstring.func_overload
directive. #377 - ๐ฑ โญ๏ธ
NewClasses
sniff: check for the PHP 5.1libXMLError
class. #412 - ๐ฑ โญ๏ธ
NewClasses
sniff: recognize all native PHP Exception classes. #418 - ๐ฑ โญ๏ธ
NewClosures
sniff: check for closures being declared as static and closures using$this
. Both of which was not supported pre-PHP 5.4. #389. Fixes #24. - โญ๏ธ
NewFunctionParameters
sniff: recognize newexclude_disabled
parameter for theget_defined_functions()
function as introduced in PHP 7.0.15. #375 - ๐ฑ โญ๏ธ
NewFunctions
sniff: recognize new PHP 7.2 socket related functions. #376 - ๐ฑ โญ๏ธ
NewInterfaces
sniff: check for some more PHP native interfaces. #411 - ๐ฑ โญ๏ธ New
isClassProperty()
,isClassConstant()
andvalidDirectScope()
utility methods to thePHPCompatibility_Sniff
class. #393, #391. - ๐ฑ โญ๏ธ New
getTypeHintsFromFunctionDeclaration()
utility method to thePHPCompatibility_Sniff
class. #414. - ๐ฑ โ๏ธ Unit tests against false positives for the
NewMagicMethods
sniff. #381 - ๐ฑ โ๏ธ More unit tests for the
getTestVersion()
utility method. #405, #430 - ๐ ๐ The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. #433
- ๐ฑ ๐ Readme: information about setting
installed_paths
via a custom ruleset. #407 - ๐ ๐
Changelog.md
file containing a record of notable changes since the first tagged release. #421
๐ Changed
- ๐ฑ ๐ The
ForbiddenNamesAsDeclared
sniff will now emitwarning
s for soft reserved keywords. #406, #370. - ๐ฑ ๐ The
ForbiddenNames
sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. #417 - ๐ ๐ The
InternalInterfaces
,NewClasses
,NewConstVisibility
,NewInterfaces
,NewMagicMethods
,NonStaticMagicMethods
andRemovedGlobalVariables
sniffs will now also sniff for and correctly report violations in combination with anonymous classes. #378, #383, #393, #394, #395, #396. Fixes #351 and #333. - ๐ฑ ๐ The
NewClasses
andNewInterfaces
sniffs will now also report on new classes/interfaces when used as type hints. #414, #416. Fixes #352 - ๐ฑ ๐ The
NewClasses
sniff will now also report on Exception classes when used in (multi-)catch
statements. #418. Fixes #373. - ๐ฑ ๐ The
NewScalarTypeDeclarations
sniff will now report on new type hints even when the type hint is nullable. #379 - ๐ The
NewNowdoc
sniff has been renamed toNewNowdocQuotedHeredoc
and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. #390 - ๐ฑ โช The
NewClasses
sniff will now also report anonymous classes whichextend
a new sniff when used in combination with PHPCS 2.4.0-2.8.0. #432. Fixes #334. - ๐ฑ โ๏ธ
NewFunctionParameter
sniff: version number precision for two parameters. #384, #428 - ๐ฑ โ๏ธ Skipping two unit tests for the
ForbiddenClosureUseVariable
sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. #408 - ๐ฑ โ๏ธ Skipping unit tests involving
trait
s in combination with PHP < 5.4 and PHPCS < 2.4.0 astrait
s are not recognized in those circumstances. #431 - ๐ โป๏ธ Various (minor) refactoring for improved performance and sniff accuracy. #385, #387, #415, #423, #424
- ๐ฑ โป๏ธ Minor simplification of the PHPUnit 6 compatibility layer and other test code. #426, #425
- General housekeeping. #398, #400
- ๐ ๐ง Minor tweaks to the Travis build script. #409
- ๐ฑ ๐ The sniffs are now also tested against PHP nightly for consistent results. #380
๐ Fixed
- ๐ฑ ๐ฅ Using unbounded ranges in
testVersion
resulted in unreported errors when used with sniffs using thesupportsBelow()
method. This affected the results of approximately half the sniffs. #430 - ๐ฑ ๐ The
ForbiddenNames
sniff would throw false positives foruse
statements with thefinal
modifier in traits. #402. - ๐ฑ ๐ The
ForbiddenNames
sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. #413 - ๐ฑ ๐ The
ForbiddenNames
sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. #419 - ๐ฑ ๐ The
ForbiddenNames
sniff would not always correctly report on use statements importing constants or functions using reserved keywords. #420 - ๐ฑ ๐ The
NewKeywords
sniff would sometimes fail to report on theconst
keyword when used in a class, but not for a class constant. #424 - ๐ ๐ PHPCS has released version 3.0 and updated the
master
branch to reflect this. This was causing the builds to fail. #422
Credits
๐ฑ Thanks go out to Juliette Reinders Folmer and Mark Clements for their contributions to this version. ๐
- ๐ฑ ๐ New
-
v7.1.3 Changes
April 02, 2017๐ See all related issues and PRs in the [7.1.3 milestone].
โ Added
- โ
:zap: The
testVersion
config parameter now allows for specifying unbounded ranges. For example: specifying-5.6
means: check for compatibility with all PHP versions up to and including PHP 5.6; Specifying7.0-
means: check for compatibility with all PHP versions from PHP 7.0 upwards. For more information about setting thetestVersion
, see Using the compatibility sniffs in the readme. - โ
:umbrella: Unit test for multi-line short arrays for the
ShortArray
sniff. #347 - โ :umbrella: Various additional unit tests against false positives. #345, #369
- โ
:umbrella: Unit tests for the
supportsBelow()
,supportsAbove()
andgetTestVersion()
utility methods. #363 - :books: Readme: information about installation of the standard using git check-out. #349
- โ
:books:
Contributing.md
file with information about reporting bugs, requesting features, making pull requests and running the unit tests. #350
๐ Changed
- :pushpin: The
ForbiddenFunctionParametersWithSameName
,NewScalarTypeDeclarations
,ParameterShadowSuperGlobals
sniff will now also sniff for and report violations in closures. #331 - :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3
nowdoc
structure has been moved from theNewKeywords
sniff to a new stand-aloneNewNowdoc
sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. #335 - :rewind: The
ForbiddenNames
sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. #362 - ๐ :recycle: Various (minor) refactoring for improved performance and sniff accuracy. #360
- โ
:recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with
testVersion
settings and makes the unit tests run ~6 x faster. Relevant additional unit tests have been added and others adjusted. #369 - ๐จ :recycle: Refactoring/tidying up of some unit test code. #343, #345, #356, #355, #359
- General housekeeping. #346
- :books: Readme: Clarify minimum requirements and influence on the results. #348
โ Removed
- :twisted_rightwards_arrows: Removed the
LongArrays
sniff. The checks it contained have been moved into theRemovedGlobalVariables
sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. #354
๐ Fixed
- :bug: The
PregReplaceEModifier
sniff would throw a false positive if a quote character was used as the regex delimiter. #357 - :bug:
RemovedGlobalVariables
sniff would report false positives for class properties shadowing the removed$HTTP_RAW_POST_DATA
variables. #354. - :bug: The
getFQClassNameFromNewToken()
utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). #338, #342 - :bug: The
determineNamespace()
utility method would in certain cases not break out a loop. #358 - :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. #341
- โ :wrench: The unit test suite is now also compatible with PHPUnit 6. #365
- :books: Readme: Typo in the composer instructions. #344
Credits
Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap:
- โ
:zap: The
-
v7.1.2 Changes
February 17, 2017๐ See all related issues and PRs in the [7.1.2 milestone].
โ Added
- ๐ :star2: New
VariableVariables
sniff to detect variables variables for which the behaviour has changed in PHP 7.0. #310 Fixes #309. - :star: The
NewReturnTypeDeclarations
sniff will now also sniff for non-scalar return type declarations, i.e.array
,callable
,self
or a class name. #323 - :star: The
NewLanguageConstructs
sniff will now also sniff for the null coalesce equal operator??=
. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. #340 - :star: New
getReturnTypeHintToken()
utility method to thePHPCompatibility_Sniff
class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. #323. - :star: New
stripVariables()
utility method to thePHPCompatibility_Sniff
class to strip variables from interpolated text strings. #341. - โ :umbrella: Additional unit tests covering previously uncovered code. #308
๐ Changed
- :pushpin: The
MbstringReplaceEModifier
,PregReplaceEModifier
andNewExecutionDirectives
sniffs will now also correctly interpret double quoted text strings with interpolated variables. #341, #324. - :pushpin: The
NewNullableTypes
sniff will now also report on nullable (return) type hints when used with closures. #323 - :pushpin: The
NewReturnTypeDeclarations
sniff will now also report on return type hints when used with closures. #323 - :pushpin: Allow for anonymous classes in the
inClassScope()
utility method. #315 - :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. #300
- :twisted_rightwards_arrows: The
NewScalarReturnTypeDeclarations
sniff has been renamed toNewReturnTypeDeclarations
. #323 - :rewind: The
ForbiddenNames
sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. #319 - :rewind: The
NewAnonymousClasses
sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. #325 - :rewind: The
NewGroupUseDeclarations
sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. #320 - :rewind: The
NewNullableTypes
sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. #323 - :rewind: The
NewReturnTypeDeclarations
sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. #323 - ๐ :recycle: Various (minor) refactoring for improved performance and sniff accuracy. #317
- :recycle: Defer to upstream
hasCondition()
utility method where appropriate. #315 - ๐จ :recycle: Minor refactoring of some unit test code. #304, #303, #318
- โ
:wrench: All unit tests now have appropriate
@group
annotations allowing for quicker/easier testing of a select group of tests/sniffs. #305 - ๐ :wrench: All unit tests now have appropriate
@covers
annotations to improve code coverage reporting and remove bleed through of accidental coverage. #307 - :wrench: Minor tweaks to the travis script. #322
- ๐ :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. #322
๐ Fixed
- :bug: The
ConstantArraysUsingDefine
sniff would throw false positives if the value of thedefine()
was retrieved via a function call and an array parameter was passed. #327 - ๐ :bug: The
ForbiddenCallTimePassByReference
sniff would throw false positives on assign by reference within function calls or conditions. #302 Fixes the last two cases reported in #68 - :bug: The
ForbiddenGlobalVariableVariableSniff
sniff would only examine the first variable in aglobal ...
statement causing unreported issues if subsequent variables were variable variables. #316 - :bug: The
NewKeywords
sniff would throw a false positive for theconst
keyword when encountered in an interface. #312 - :bug: The
NewNullableTypes
sniff would not report on nullable return types for namespaced classnames used as a type hint. #323 - :bug: The
PregReplaceEModifier
sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of thee
modifier when an array of regexes was passed. #300 - :bug: The
PregReplaceEModifier
sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. #300 - :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). #313, #323, #326, #340
Credits
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
- ๐ :star2: New
-
v7.1.1 Changes
December 14, 2016๐ See all related issues and PRs in the [7.1.1 milestone].
โ Added
- :star:
ForbiddenNamesAsDeclared
sniff: detection of the PHP 7.1iterable
andvoid
reserved keywords when used to name classes, interfaces or traits. #298
๐ Fixed
- ๐ฏ :bug: The
ForbiddenNamesAsInvokedFunctions
sniff would incorrectly throw an error if theclone
keyword was used with parenthesis. #299. Fixes #284
Credits
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
- :star:
-
v7.1.0 Changes
December 14, 2016๐ See all related issues and PRs in the [7.1.0 milestone].
โ Added
- :star: New
stringToErrorCode()
,arrayKeysToLowercase()
andaddMessage()
utility methods to thePHPCompatibility_Sniff
class. #291.
๐ Changed
- :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. #291
- :pencil2: Minor changes to some of the error message texts for consistency across sniffs. #291
- ๐จ :recycle: Refactored the complex version sniffs to reduce code duplication. #291
- ๐ :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. #291
- ๐ :umbrella: The unit tests for the
RemovedExtensions
sniff now verify that the correct alternative extension is being suggested. #291
Credits
Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
- :star: New