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. 👏