PHPCompatibility v7.1.2 Release Notes

Release Date: 2017-02-17 // about 7 years ago
  • 👀 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 the PHPCompatibility_Sniff class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. #323.
    • :star: New stripVariables() utility method to the PHPCompatibility_Sniff class to strip variables from interpolated text strings. #341.
    • ✅ :umbrella: Additional unit tests covering previously uncovered code. #308

    🔄 Changed

    • :pushpin: The MbstringReplaceEModifier, PregReplaceEModifier and NewExecutionDirectives 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 to NewReturnTypeDeclarations. #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 the define() 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 a global ... statement causing unreported issues if subsequent variables were variable variables. #316
    • :bug: The NewKeywords sniff would throw a false positive for the const 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 the e 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: