Skip to content

Releases: PHPCSStandards/PHPCSExtra

1.2.1 - 2023-12-08

08 Dec 16:51
11d387c
Compare
Choose a tag to compare

Changed

Other

  • Composer: The minimum PHP_CodeSniffer requirement has been updated to ^3.8.0 (was ^3.7.2). #298
  • Composer: The minimum PHPCSUtils requirement has been updated to ^1.0.9 (was ^1.0.8). #298

Please ensure you run composer update phpcsstandards/phpcsextra --with-dependencies to benefit from this.

1.2.0 - 2023-12-02

02 Dec 14:32
78b2cae
Compare
Choose a tag to compare

Added

Universal

  • 🔧 📚 New Universal.CodeAnalysis.NoDoubleNegative sniff to detect double negatives (!!) and advise to use a boolean cast instead. Thanks @diedexx for reviewing. #277
  • 🔧 📚 New Universal.Operators.ConcatPosition sniff to enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. #294
  • 🔧 📊 📚 New Universal.PHP.LowercasePHPTag sniff to enforce that the "PHP" in a PHP open tag is lowercase. Thanks @fredden for reviewing. #276

Changed

NormalizedArrays

  • NormalizedArrays.Arrays.CommaAfterLast: the sniff now has two extra error codes to distinguish between multi-line arrays with the last array item on the same line as the array closer vs the last array item being on a line before the array closer. Thanks @stronk7 for suggesting and patching this. #283, #284
    These new error codes allow for selectively excluding that specific situation from triggering the sniff.
    The new error codes are FoundMultiLineCloserSameLine (for multiLine="forbid") and MissingMultiLineCloserSameLine (for multiLine="enforce").
    The pre-existing FoundMultiLine and FoundSingleLine error codes continue to be used for multi-line arrays with the last array item on a different line than the array closer.

Other

  • Various housekeeping.

1.1.2 - 2023-09-21

20 Sep 22:10
746c319
Compare
Choose a tag to compare

Changed

Other

  • Various housekeeping.

Fixed

Universal

  • Universal.CodeAnalysis.ConstructorDestructorReturn: the sniff will now correctly ignore methods mirroring the class name (PHP-4 style constructors) in namespaced code. #207, #272

1.1.1 - 2023-08-26

26 Aug 04:50
98bcdba
Compare
Choose a tag to compare

Changed

Modernize

  • Modernize.FunctionCalls.Dirname: the sniff will now respect a potentially set php_version configuration option and only report on modernizations which are possible on the configured php_version. #261
    If the php_version is not set, the sniff will continue to report on all modernization options.

Other

  • Various documentation improvements. Props in part to @szepeviktor.
  • Improved defensive coding in select places.
  • Various housekeeping.

1.1.0 - 2023-07-19

19 Jul 19:44
61a9be9
Compare
Choose a tag to compare

Added

Universal

  • 🔧 📚 New Universal.CodeAnalysis.NoEchoSprintf sniff to detect use of the inefficient echo [v]sprintf(...); combi and recommends using [v]printf() instead. #242
  • 📊 📚 New Universal.FunctionDeclarations.NoLongClosures sniff to detect "long" closures and recommend using a named function instead. #240
    The sniff offers the following properties to influence its behaviour: recommendedLines (defaults to 5), maxLines (defaults to 8), ignoreCommentLines (defaults to true) and ignoreEmptyLines (defaults to true).
  • 🔧 📊 📚 New Universal.FunctionDeclarations.RequireFinalMethodsInTraits sniff to enforce non-private, non-abstract methods in traits to be declared as final. #243, #245
    There is a separate NonFinalMagicMethodFound error code for magic methods to allow those to be excluded from the check.
  • 🔧 📊 📚 New Universal.UseStatements.DisallowMixedGroupUse sniff to disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement. #241, #246
    Note: the fixer will use a semi-standardized format for group use statements. If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format.
  • 🔧 📊 📚 New Universal.UseStatements.KeywordSpacing sniff to enforce the use of a single space after the use, function, const keywords and both before and after the as keyword in import use statements. #247
    The sniff has modular error codes to allow for disabling individual checks.
  • 🔧 📚 New Universal.UseStatements.NoUselessAliases sniff to detect useless aliases (aliasing something to its original name) in import use statements. #244
    Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless.
  • 🔧 📊 📚 New Universal.WhiteSpace.CommaSpacing sniff to enforce that there is no space before a comma and exactly one space, or a new line, after a comma. #254
    Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment.
    The sniff has modular error codes to allow for disabling individual checks and checks in certain contexts.
    The sniff will respect a potentially set php_version configuration option when deciding how to handle the spacing after a heredoc/nowdoc closer.

Changed

Universal

  • Minor performance improvements for the Universal.Arrays.DuplicateArrayKey and the Universal.CodeAnalysis.ConstructorDestructorReturn sniffs. #251, #252

Other

  • Composer: The minimum PHPCSUtils requirement has been updated to ^1.0.8 (was ^1.0.6). #249, #254
  • Various housekeeping.

1.0.4 - 2023-06-18

17 Jun 23:02
029af41
Compare
Choose a tag to compare

Changed

Other

  • Composer: The minimum PHPCSUtils requirement has been updated to ^1.0.6 (was ^1.0.0). #237
  • Various housekeeping.

Fixed

Universal

  • Universal.Constants.LowercaseClassResolutionKeyword: prevent false positives for function calls to methods called class. #226

1.0.3 - 2023-03-28

28 Mar 17:51
7029c05
Compare
Choose a tag to compare

Changed

Universal

  • Universal.WhiteSpace.DisallowInlineTabs: significant performance improvement. #216, #217

Other

  • Various housekeeping.

Fixed

Modernize

  • Modernize.FunctionCalls.Dirname: prevent false positives for attribute classes called dirname. #211, #213

1.0.2 - 2023-01-10

09 Jan 22:18
a077c4a
Compare
Choose a tag to compare

Changed

Universal

  • Universal.CodeAnalysis.ConstructorDestructorReturn: the sniff will now respect a potentially set php_version configuration option and only report on PHP4-style constructors when the php_version is below '80000'. Thanks @anomiex for reporting! #207, #208

1.0.1 - 2023-01-05

05 Jan 12:39
0f55c12
Compare
Choose a tag to compare

Fixed

Universal

  • Universal.CodeAnalysis.ConstructorDestructorReturn: fixed false positive for return statements in nested functions/closures declared within constructor/destructor methods. Thanks @anomiex for reporting! #201, #202

1.0.0 - 2023-01-04

04 Jan 00:34
5ab4e9e
Compare
Choose a tag to compare

⚠️ Important: this package now requires PHPCSUtils 1.0.0. Please make sure you use --with-[all-]dependencies when running composer update. ❗

For the full list of features, please see the changelogs of the alpha/rc releases:

Changed

Other

  • Updated various sniffs to take advantage of PHPCSUtils 1.0.0(-rc1). #193, #194, #195
  • Minor documentation improvements.
  • Various housekeeping.

Fixed

Modernize

  • Modernize.FunctionCalls.Dirname: the sniff will now correctly recognize magic constants in a case-insensitive manner. #187