Skip to content

2.10.0

Latest

Choose a tag to compare

@dereuromark dereuromark released this 25 Oct 20:57
59a9205

Fixes

  • phpcbf no longer loops on inline parameter attributes (#48). SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing moved the target of an attribute such as #[SensitiveParameter] array $credentials onto its own line. That made the signature multi-line, so the trailing-comma sniffs added and removed a comma until phpcbf gave up with "FAILED TO FIX". Attributes on the same line as their target are now allowed.

  • Fixes from php-collective/code-sniffer 0.6.10, which is the new floor. Three of them reach sniffs PSR2R enables:

    • PhpCollective.Commenting.InlineDocBlock no longer rotates the words of an inline var annotation that has a description, and no longer adds a space before */ on every pass when the comment ends in . or similar.
    • PhpCollective.WhiteSpace.ConsistentIndent keeps the PSR12 indent of a multi-line for (...) header.
    • PhpCollective.Classes.Psr4 no longer aborts the whole run when there is no composer.json.

Improvements

  • Wrapped operators go to the start of the continuation line (#48). PhpCollective.Operators.OperatorPosition applies the rule Universal.Operators.ConcatPosition already enforces for . to &&, ||, and, or, xor, ??, the ternary ? and :, and binary arithmetic operators:

    // before
    $valid = $hasName &&
        $hasEmail;
    
    // after
    $valid = $hasName
        && $hasEmail;
  • Multi-catch types are written without spaces (#48), the same as union types:

    } catch (ValueError|TypeError $e) {

    PhpCollective.WhiteSpace.CatchTypeSeparatorSpacing reports the spaced form, and PhpCollective.Operators.OperatorSpacing replaces PSR12.Operators.OperatorSpacing, which used to require the spaces. All other operators keep the PSR12 rule.

Note

Both improvements report code that passed before. All new errors are auto-fixable with phpcbf. Adjust any baseline, phpcs:ignore or ruleset exclusion that names PSR12.Operators.OperatorSpacing: the same checks now report as PhpCollective.Operators.OperatorSpacing.

Full Changelog: 2.9.0...2.10.0