Releases: PHPCompatibility/PHPCompatibility
7.0.8: PHP 7.0 Sniffs - update 2016-10-31 - Spooky !
PHP 7.0 Sniffs - update 2016-10-31 - Spooky !
See all related issues and PRs in the 7.0.8 milestone.
Added
- π New
ForbiddenNamesAsDeclared
sniff: detection of the other reserved keywords which are reserved as of PHP 7.0 (or higher). #287. Fixes #115.
These were previously sniffed for by theForbiddenNames
andForbiddenNamesAsInvokedFunctions
sniffs causing false positives as the rules for their reservation are different from the rules for "normal" reserved keywords. - β New
inUseScope()
utility method to thePHPCompatibility_Sniff
class which handles PHPCS cross-version compatibility when determining the scope of ause
statement. #271. - β More unit tests for the
ForbiddenNames
sniff. #271.
Changed
- π Deprecated functionality should throw a
warning
. Removed or otherwise unavailable functionality should throw anerror
. This distinction was previously not consistently applied everywhere. #286
This change affects the following sniffs:DeprecatedPHP4StyleConstructors
will now throw awarning
instead of anerror
for deprecated PHP4 style class constructors.ForbiddenCallTimePassByReference
will now throw awarning
if thetestVersion
is5.3
and anerror
if thetestVersion
if5.4
or higher.MbstringReplaceEModifier
will now throw awarning
instead of anerror
for usage of the deprecatede
modifier.PregReplaceEModifier
will now throw awarning
if thetestVersion
is5.5
or5.6
and anerror
if thetestVersion
if7.0
or higher. Fixes #290.TernaryOperators
will now throw anerror
when thetestVersion
<5.3
and the middle part has been omitted.ValidIntegers
will now throw awarning
when an invalid binary integer is detected.
- βοΈ
DeprecatedFunctions
andDeprecatedIniDirectives
sniffs: minor change in the sniff error message text. Use "removed" rather than the ominous "forbidden". #285
Also updated relevant internal variable names and documentation to match.
Fixed
- π
ForbiddenNames
sniff would throw false positives foruse
statements which changed the visibility of methods in traits. #271. - π
ForbiddenNames
sniff would not report reserved keywords when used in combination withuse function
oruse const
. #271. - π
ForbiddenNames
sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. #271. - π§ Composer config:
prefer-stable
should be a root element of the json file. Fixes #277.
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. π
7.0.7: PHP 7.0 Sniffs - update 2016-10-20
PHP 7.0 Sniffs - update 2016-10-20
See all related issues and PRs in the 7.0.7 milestone.
Added
- π New
ForbiddenBreakContinueOutsideLoop
sniff: verify thatbreak
/continue
is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. #278. Fixes #275 - π New
NewConstVisibility
sniff: detect visibility indicators forclass
andinterface
constants as introduced in PHP 7.1. #280. Fixes #249 - π New
NewHashAlgorithms
sniff to check used hash algorithms against the PHP version in which they were introduced. #242 - π New
NewMultiCatch
sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. #281. Fixes #251 - π New
NewNullableTypes
sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. #282. Fixes #247 - β
DeprecatedIniDirectives
sniff: recognize PHP 7.1 removedsession
ini directives. #256 - β
NewFunctions
sniff: recognize newsocket_export_stream()
function as introduced in PHP 7.0.7. #264 - β
NewFunctions
sniff: recognize newcurl_...()
,is_iterable()
,pcntl_async_signals()
,session_create_id()
,session_gc()
functions as introduced in PHP 7.1. #273 - β
NewFunctionParameters
sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. #258 - β
NewIniDirectives
sniff: recognize newsession
ini directives as introduced in PHP 7.1. #259 - β
NewScalarReturnTypeDeclarations
sniff: recognize PHP 7.1void
return type hint. #250 - β
NewScalarTypeDeclarations
sniff: recognize PHP 7.1iterable
type hint. #255 - β Recognize the PHP 7.1 deprecated
mcrypt
functionality in theRemovedExtensions
,DeprecatedFunctions
andDeprecatedIniDirectives
sniffs. #257
Changed
- π
LongArrays
sniff used to only throwwarning
s. It will now throwerror
s for PHP versions in which the long superglobals have been removed. #270 - π The
NewIniDirectives
sniff used to always throw anwarning
. Now it will throw anerror
when a new ini directive is used in combination withini_set()
. #246. - π
RemovedHashAlgorithms
sniff: also recognize removed algorithms when used with the PHP 5.5+hash_pbkdf2()
function. #240 - π Properly recognize nullable type hints in the
getMethodParameters()
utility method. #282 - βοΈ
DeprecatedPHP4StyleConstructors
sniff: minor error message text fix. #236 - βοΈ
NewIniDirectives
sniff: improved precision for the introduction version numbers being reported. #246 - β»οΈ Various (minor) refactoring for improved performance and sniff accuracy. #238, #244, #240, #276
- β Re-activate the unit tests for the
NewScalarReturnTypeDeclarations
sniff. #250
Fixed
- π The
DeprecatedPHP4StyleConstructors
sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. #236 - π
LongArrays
sniff would report false positives for class properties shadowing removed PHP superglobals. #270. Fixes #268. - π The
NewClasses
sniff would not report errors when the case of the class name used and "official" class name did not match. #237 - π The
NewIniDirectives
sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. #246 - π
PregReplaceEModifier
sniff would report false positives for compound regex parameters with different quote types. #266. Fixes #265. - π
RemovedGlobalVariables
sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. #245. - π The
RemovedHashAlgorithms
sniff would not report errors when the case of the hash function name used and "official" class name did not match. #240 - π The
ShortArray
sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. #238
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. π
7.0.6: PHP 7.0 Sniffs - update 2016-09-23
PHP 7.0 Sniffs - update 2016-09-23
See all related issues and PRs in the 7.0.6 milestone.
Added
- β New
stripQuotes()
utility method in thePHPCompatibility_Sniff
base class to strip quotes which surround text strings in a consistent manner. #224 - π Readme: Add PHP Version Support section. #225
Changed
- π The
ForbiddenCallTimePassByReference
sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. #203 - π The
NewFunctionArrayDereferencing
sniff will now also check method calls for array dereferencing, not just function calls. #229. Fixes #227. - βοΈ The
NewExecutionDirectives
sniff will now throwwarning
s instead oferror
s for invalid values encountered in execution directives. #223 - βοΈ Minor miscellaneous fixes. #231
- β»οΈ Various (minor) refactoring for improved performance and sniff accuracy. #219, #203
- β»οΈ Defer to upstream
findImplementedInterfaceNames()
utility method when it exists. #222 - π§ Exclude the test files from analysis by Scrutinizer CI. #230
Removed
- π« Some redundant code. #232
Fixed
- π The
EmptyNonVariable
sniff would throw false positives for variable variables and for array access with a (partially) variable array index. #212. Fixes #210. - π The
NewFunctionArrayDereferencing
sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. #228. Fixes #226. - π
ParameterShadowSuperGlobals
sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. #218. Fixes #214. - π The
determineNamespace()
utility method now accounts properly for namespaces within scopeddeclare()
statements. #221 - π Readme: Logo alignment in the Credits section. #233
Credits
Thanks go out to Jason Stallings, Juliette Reinders Folmer and Mark Clements for their contributions to this version. π
7.0.5: PHP 7.0 Sniffs - update 2016-09-08
PHP 7.0 Sniffs - update 2016-09-08
See all related issues and PRs in the 7.0.5 milestone.
Added
- π New
MbstringReplaceEModifier
sniff to detect the use of the PHP 7.1 deprecatede
modifier in Mbstring regex functions. #202 - β The
ForbiddenBreakContinueVariableArguments
sniff will now also report onbreak 0
/continue 0
which is not allowed since PHP 5.4. #209 - β New
getFunctionCallParameters()
,getFunctionCallParameter()
utility methods in thePHPCompatibility_Sniff
base class. #170 - β New
tokenHasScope()
utility method in thePHPCompatibility_Sniff
base class. #189 - β Unit test for
goto
andcallable
detection and some other miscellanous extra unit tests for theNewKeywords
sniff. #189 - π Readme: Information for sniff developers about running unit tests for other sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. #217
Changed
- π The
ForbiddenNames
sniff will now also check interface declarations for usage of reserved keywords. #200 - π
PregReplaceEModifier
sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. #201 - βͺ The
NewKeywords
sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. #189 - βοΈ
PregReplaceEModifier
sniff: minor improvement to the error message text. #201 - β»οΈ Various (minor) refactoring for improved performance and sniff accuracy. #170, #188, #189, #199, #200, #201, #208
- π§ The unit tests for the utility methods have been moved to their own subdirectory within
Tests
. #215 - π The sniffs are now also tested against PHP 7.1 for consistent results. #216
Removed
Fixed
- π
ConstantArraysUsingDefine
sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #199 - π The
DeprecatedIniDirectives
andNewIniDirectives
sniffs could potentially trigger on the ini value instead of the ini directive name. #170 - π
ForbiddenNames
sniff: Reserved keywords when used as the name of a constant declared usingdefine()
would always be reported independently of thetestVersion
set. #200 - π
PregReplaceEModifier
sniff would not report errors when the function name used was not in lowercase. #201 - π
TernaryOperators
sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #188 - π The
getFQClassNameFromNewToken()
andgetFQClassNameFromDoubleColonToken()
utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. #206. Fixes #205. - π The
getFunctionCallParameters()
utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. ThegetFunctionCallParameters()
utility method also did not handle parameters passed as short arrays correctly. #213. Fixes #211. - β Unit tests for the
NewFunctionArrayDereferencing
sniff were not being run due to a naming error. #208 - π Readme: Information about setting the
testVersion
from a custom ruleset was incorrect. #204 - π§ Path to PHPCS in the unit tests breaking for non-Composer installs. #198
Credits
Thanks go out to Juliette Reinders Folmer and Yoshiaki Yoshida for their contributions to this version. π
7.0.4: PHP 7.0 Sniffs - update 2016-08-20
See all related issues and PRs in the 7.0.4 milestone.
Added
- π New
EmptyNonVariable
sniff: detection of empty being used on non-variables for PHP < 5.5. #187 - π New
NewMagicMethods
sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the__toString()
magic method in PHP 5.2. #176. Fixes #64. - π New
RemovedAlternativePHPTags
sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. #184, #193. Fixes #127. - β
NonStaticMagicMethods
sniff: detection of the__callStatic()
,__sleep()
,__toString()
and__set_state()
magic methods. - π Lint all non-test case files for syntax errors during the build testing by Travis. #192
Changed
- π
NonStaticMagicMethods
sniff: will now also snifftrait
s for magic methods. #174 - π
NonStaticMagicMethods
sniff: will now also check for magic methods which should be declared asstatic
. #174 - β»οΈ Various (minor) refactoring for improved performance and sniff accuracy. #178, #179, #174, #171
- β»οΈ The unit test suite now internally caches PHPCS run results in combination with a set
testVersion
to speed up the running of the unit tests. These are now ~3 x faster. #148 - π Readme: Minor clarification of the minimum requirements.
- π Readme: Advise to use the latest stable version of this repository.
- π§ The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. #191.
- π§ Improved coveralls configuration and compatibility. #194
- π The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. #196
Fixed
- π The
ForbiddenBreakContinueVariableArguments
sniff would not report onbreak
/continue
with a closure as an argument. #171 - π The
ForbiddenNamesAsInvokedFunctions
sniff would not report on reserved keywords which were not lowercase. #186 - π The
ForbiddenNamesAsInvokedFunctions
sniff would not report on thegoto
andnamespace
keywords when run on PHP 5.2. #193 - π
NewAnonymousClasses
sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #195. - π
NewGroupUseDeclarations
sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. #190. - π The
NonStaticMagicMethods
sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. #174 - π§ The unit tests would exit with
0
if PHPCS could not be found. #191 - π The PHPCompatibility library itself was not fully compatible with PHP 5.2. #193
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. π
7.0.3: PHP 7.0 Sniffs - update 2016-08-18
Fixes + improvements on 7.0.2
See all related issues and PRs in the 7.0.3 milestone.
Added
- π New
InternalInterfaces
sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. #144 - π New
LateStaticBinding
sniff: detection of PHP 5.3 late static binding. #177 - π New
NewExecutionDirectives
sniff: verify execution directives set withdeclare()
. #169 - π New
NewInterfaces
sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements theSerializable
interface. #144 - π New
RequiredOptionalFunctionParameters
sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. #165 - π New
ValidIntegers
sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. #160. Fixes #55. - β
DeprecatedExtensions
sniff: detect removal of theereg
extension in PHP 7. #149 - β
DeprecatedFunctions
sniff: detection of the PHP 5.0.5 deprecatedphp_check_syntax()
and PHP 5.4 deprecatedmysqli_get_cache_stats()
functions. #155. - β
DeprecatedFunctions
sniff: detect deprecation of a number of themysqli
functions in PHP 5.3. #149 - β
DeprecatedFunctions
sniff: detect removal of thecall_user_method()
,ldap_sort()
,ereg_*()
andmysql_*()
functions in PHP 7.0. #149 - β
DeprecatedIniDirectives
sniff: detection of a lot more deprecated/removed ini directives. #146 - β
NewFunctionParameters
sniff: detection of a lot more new function parameters. #164 - β
NewFunctions
sniff: detection of numerous extra new functions. #161 - β
NewIniDirectives
sniff: detection of a lot more new ini directives. #146 - β
NewLanguageConstructs
sniff: detection of the PHP 5.6 ellipsis...
construct. #175 - β
NewScalarTypeDeclarations
sniff: detection of PHP 5.1array
and PHP 5.4callable
type hints. #168 - β
RemovedFunctionParameters
sniff: detection of a few extra removed function parameters. #163 - β Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream
Generic.NamingConventions.CamelCapsFunctionName
sniff is re-used for this with some customization. #173 - β New
getFQClassNameFromNewToken()
,getFQExtendedClassName()
,getFQClassNameFromDoubleColonToken()
,getFQName()
,isNamespaced()
,determineNamespace()
andgetDeclaredNamespaceName()
utility methods in thePHPCompatibility_Sniff
base class for namespace determination. #162 - β»οΈ New
inClassScope()
utility method in thePHPCompatibility_Sniff
base class. #168 - β»οΈ New
doesFunctionCallHaveParameters()
andgetFunctionCallParameterCount()
utility methods in thePHPCompatibility_Sniff
base class. #153 - β Unit test for
__halt_compiler()
detection by theNewKeywords
sniff. - β Unit tests for the
NewFunctions
sniff. #161 - β Unit tests for the
ParameterShadowSuperGlobals
sniff. #180 - π§ Minimal config for Scrutinizer CI. #145.
Changed
- π The
DeprecatedIniDirectives
and theNewIniDirectives
sniffs will now indicate an alternative ini directive in case the directive has been renamed. #146 - π The
NewClasses
sniff will now also report on new classes being extended by child classes. #140. - π The
NewClasses
sniff will now also report on static use of new classes. #162. - π The
NewScalarTypeDeclarations
sniff will now throw an error on use of type hints pre-PHP 5.0. #168 - π The
NewScalarTypeDeclarations
sniff will now verify type hints used against typical mistakes. #168 - π The
ParameterShadowSuperGlobals
sniff will now do a case-insensitive variable name compare. #180 - π The
RemovedFunctionParameters
sniff will now also reportwarning
s on deprecation of function parameters. #163 - π The check for
JsonSerializable
has been moved from theNewClasses
sniff to theNewInterfaces
sniff. #162 - βͺ The
NewLanguageConstructs
sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. #175 - βοΈ
NewFunctionParameters
sniff: use correct name for the new parameter for thedirname()
function. #164 - βοΈ
NewScalarTypeDeclarations
sniff: minor change in the sniff error message text. #168 - βοΈ
RemovedFunctionParameters
sniff: minor change in the sniff error message text. #163 - βοΈ The
ParameterShadowSuperGlobals
sniff now extends thePHPCompatibility_Sniff
class. #180 - β»οΈ Various (minor) refactoring for improved performance and sniff accuracy. #181, #182, #166, #167, #172, #180, #146, #138
- β»οΈ Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. #139, #149
Fixed
- π The
DeprecatedFunctions
sniff was reporting an incorrect deprecation/removal version number for a few functions. #149 - π The
DeprecatedIniDirectives
sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. #146 - π The
DeprecatedPHP4StyleConstructors
sniff would cause false positives for methods with the same name as the class in namespaced classes. #167 - π The
ForbiddenEmptyListAssignment
sniff did not report errors when there were only comments or parentheses between the list parentheses. #166 - π The
ForbiddenEmptyListAssignment
sniff will no longer cause false positives during live coding. #166 - π The
NewClasses
sniff would potentially misidentify namespaced classes as PHP native classes. #161 - π The
NewFunctions
sniff would fail to identify called functions when the function call was not lowercase. #161 - π The
NewFunctions
sniff would potentially misidentify namespaced userland functions as new functions. #161 - π The
NewIniDirectives
sniff was reporting an incorrect introduction version number for a few ini directives. #146 - π
NewKeywords
sniff: the use of theconst
keyword should only be reported when used outside of a class for PHP < 5.3. #147. Fixes #129. - π The
RemovedExtensions
sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. #156 - :bug...
7.0.2: PHP 7.0 Sniffs - update 2016-08-03
Fixes + improvements on 7.0.1
See all related issues and PRs in the 7.0.2 milestone.
Added
- β
RemovedExtensions
sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. #130. Fixes #123.
To use this feature, add thefunctionWhitelist
property in your custom ruleset. For more information, see the README.
Changed
- βοΈ A number of sniffs contained
public
class properties. Within PHPCS,public
properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed toprotected
. #135 - π§ Composer config: Stable packages are preferred over unstable/dev.
- βοΈ Ruleset name. #134
Credits
Thanks go out to Juliette Reinders Folmer for her contributions to this version. π
7.0.1: PHP 7.0 Sniffs - update 2016-08-02
All PHP 7.0 sniffs + fixes for sniffs for previous versions
See all related issues and PRs in the 7.0.1 milestone.
Changed
- π The
DeprecatedIniDirectives
sniff used to throw anerror
when a deprecated ini directive was used in combination withini_get()
. It will now throw awarning
instead. #122 Fixes #119.
Usage of deprecated ini directives in combination withini_set()
will still throw anerror
. - π The
PregReplaceEModifier
sniff now also detects thee
modifier when used with thepreg_filter()
function. While this is undocumented, thee
modifier was supported by thepreg_filter()
function as well. #128 - βοΈ The
RemovedExtensions
sniff contained superfluous deprecation information in the error message. #131
Removed
- π§ Duplicate builds from the Travis CI build matrix. #132
Fixed
- π The
ForbiddenNames
sniff did not allow for the PHP 5.6use function ...
anduse const ...
syntax. #126 Fixes #124. - π The
NewClasses
sniff failed to detect new classes when the class was instantiated without parenthesis, i.e.new NewClass;
. #121 - π The
PregReplaceEModifier
sniff failed to detect thee
modifier when using bracket delimiters for the regex other than the{}
brackets. #128 - π Unit tests failing against PHPCS 2.6.1.
Credits
Thanks go out to Jason Stallings, Juliette Reinders Folmer and Ryan Neufeld for their contributions to this version. π
PHP 7.0 Sniffs
See all related issues and PRs in the 7.0 milestone.
Added
- β‘ Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e.
--runtime-set testVersion 5.0-5.4
will now test your code for compatibility with PHP 5.0 up to PHP 5.4. #99 - π New
NewFunctionArrayDereferencing
sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes #52. - π New
ShortArray
sniff to detect short array syntax as introduced in PHP 5.4. #97. Fixes #47. - π New
TernaryOperators
sniff to detect ternaries without the middle part (elvis
operator) as introduced in PHP 5.3. #101, #103. Fixes #49. - π New
ConstantArraysUsingDefine
sniff to detect constants declared usingdefine()
being assigned anarray
value which was not allowed prior to PHP 7.0. #110 - π New
DeprecatedPHP4StyleConstructors
sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. #109. - π New
ForbiddenEmptyListAssignment
sniff to detect empty list() assignments which have been removed in PHP 7.0. #110 - π New
ForbiddenFunctionParametersWithSameName
sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. #110 - π New
ForbiddenGlobalVariableVariable
sniff to detect variable variables being madeglobal
which is not allowed since PHP 7.0. #110 - π New
ForbiddenNegativeBitshift
sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. #110 - π New
ForbiddenSwitchWithMultipleDefaultBlocks
sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. #110 - π New
NewAnonymousClasses
sniff to detect anonymous classes as introduced in PHP 7.0. #110 - π New
NewFunctionParameters
sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+before_needle
parameter for thestrstr()
function. #110, #112. Fixes #27. - π New
NewGroupUseDeclarations
sniff to detect group use declarations as introduced in PHP 7.0. #110 - π New
NewScalarReturnTypeDeclarations
sniff to detect scalar return type hints as introduced in PHP 7.0. #110 - π New
NewScalarTypeDeclarations
sniff to detect scalar function parameter type hints as introduced in PHP 7.0. #110 - π New
RemovedFunctionParameters
sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. #110 - π New
RemovedGlobalVariables
sniff to detect the PHP 7.0 removed$HTTP_RAW_POST_DATA
superglobal. #110 - β
DeprecatedFunctions
sniff: detection of the PHP 5.4 deprecated OCI8 functions. #93 - β
ForbiddenNamesAsInvokedFunctions
sniff: recognize PHP 5.5finally
as a reserved keywords when invoked as a function. #110 - β
NewKeywords
sniff: detection of the use of the PHP 5.1+__halt_compiler
keyword. Fixes #50. - β
NewKeywords
sniff: detection of the PHP 5.3+nowdoc
syntax. Fixes #48. - β
NewKeywords
sniff: detection of the use of theconst
keyword outside of a class for PHP < 5.3. Fixes #50. - β
DeprecatedFunctions
sniff: recognize PHP 7.0 deprecated and removed functions. #110 - β
DeprecatedIniDirectives
sniff: recognize PHP 7.0 removed ini directives. #110 - β
ForbiddenNamesAsInvokedFunctions
sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. #110 - β
ForbiddenNames
sniff: recognize new PHP 7.0 reserved keywords. #110 - β
NewFunctions
sniff: recognize new functions as introduced in PHP 7.0. #110 - β
NewLanguageConstructs
sniff: recognize new PHP 7.0<=>
"spaceship" and??
null coalescing operators. #110 - β
RemovedExtensions
sniff: recognize PHP 7.0 removedereg
,mssql
,mysql
andsybase_ct
extensions. #110 - β Additional unit tests for the
NewLanguageConstructs
sniff. #110 - π Readme: New section containing information about the use of the
testVersion
config variable. - π Readme: Sponsor credits.
Changed
- π The
DeprecatedIniDirectives
sniff used to always throw anwarning
. Now it will throw anerror
when a removed ini directive is used. #110. - π The
DeprecatedNewReference
sniff will now throw an error when thetestVersion
includes PHP 7.0 or higher. #110 - π The
ForbiddenNames
sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. #108, #110. - π The
PregReplaceEModifier
sniff will now throw an error when thetestVersion
includes PHP 7.0 or higher. #110 - βοΈ
NewKeywords
sniff: clarified the error message text for theuse
keyword. Fixes #46. - β»οΈ Minor refactor of the
testVersion
related utility functions. #98 - π§ Add autoload to the
composer.json
file. #96 Fixes #67. - π§ Minor other updates to the
composer.json
file. #75 - π§ Improved creation of the code coverage reports needed by coveralls via Travis.
- π The sniffs are now also tested against PHP 7.0 for consistent results.
Fixed
- π The
ForbiddenCallTimePassByReference
sniff was throwingUndefined index
notices when used in combination with PHPCS 2.2.0. #100. Fixes #42. - π The
ForbiddenNamesAsInvokedFunctions
sniff would incorrectly throw an error if thethrow
keyword was used with parenthesis. Fixes #118. - π The
PregReplaceEModifier
sniff incorrectly identifiede
's in the pattern as thee
modifier when using{}
bracket delimiters for the regex. #94 - π The
RemovedExtensions
sniff was throwing anerror
instead of awarning
for deprecated, but not (yet) removed extensions. Fixes #62.
Credits
Thanks go out to AlexMiroshnikov, Chris Abernethy, dgudgeon, djaenecke, Eugene Maslovich, Ken Guest, Koen Eelen, Komarov Alexey, Mark Clements and Remko van Bezooijen for their contributions to this version. π
PHP 5.6 release
See all related issues and PRs in the 5.6 milestone.
Added
- π New:
NewLanguageConstructs
sniff. The initial version of this sniff checks for the PHP 5.6**
power operator and the**=
power assignment operator. #87. Fixes #60. - π New:
ParameterShadowSuperGlobals
sniff which covers the PHP 5.4 change Parameter names that shadow super globals now cause a fatal error.`. #74 - π New:
PregReplaceEModifier
sniff which detects usage of thee
modifier in literal regular expressions used withpreg_replace()
. Thee
modifier will not (yet) be detected when the regex passed is a variable or constant. #81, #84. Fixes #71, #83. - β
DeprecatedIniDirectives
sniff: PHP 5.6 deprecated ini directives. - β
NewKeywords
sniff: detection of thegoto
keyword introduced in PHP 5.3 and thecallable
keyword introduced in PHP 5.4. #57 - β»οΈ
PHPCompatibility_Sniff
base class initially containing thesupportsAbove()
andsupportsBelow()
utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a settestVersion
. #77 - π Readme: Composer installation instructions. #32, #61
- π§
.gitignore
to ignore vendor and IDE related directories. #78 - π Code coverage checking via coveralls.
Changed
- π The check for the
\
namespace separator has been moved from theNewKeywords
sniff to theNewLanguageConstructs
sniff. #88 - βοΈ
DeprecatedIniDirectives
sniff: minor change in the sniff error message text. - βοΈ
DeprecatedFunctions
sniff: minor change in the sniff error message text. - π§ Minor updates to the
composer.json
file. #31, 34, #70 - π§ Tests: The unit tests can now be run without configuration.
- π§ Tests: Skipped unit tests will now be annotated as such. #85
- π The sniffs are now also tested against PHP 5.6 for consistent results.
- π The sniffs are now also tested against PHPCS 2.0+.
- π The sniffs are now tested using the new container-based infrastructure in Travis CI. #37
Fixed
- π The
ForbiddenCallTimePassByReference
sniff was throwing false positives when a bitwise and&
was used in combination with class constants and class properties within function calls. #44. Fixes #39. - π The
ForbiddenNamesAsInvokedFunctions
sniff was throwing false positives in certain cases when a comment separated atry
from thecatch
block. #29 - π The
ForbiddenNamesAsInvokedFunctions
sniff was incorrectly reportinginstanceof
as being introduced in PHP 5.4 while it has been around since PHP 5.0. #80 - β Compatibility with PHPCS 2.0 - 2.3. #63, #65
Credits
Thanks go out to Daniel Janecke, Declan Kelly, Dominic, Jaap van Otterdijk, Marin Crnkovic, Mark Clements, Nick Pack, Oliver Klee, Rowan Collins and Sam Van der Borght for their contributions to this version. π