Problem/Motivation

In #3224523: [PHP 8.1] Add ReturnTypeWillChange attribute where necessary we introduced #[\ReturnTypeWillChange].

The sniff "Drupal.Commenting.InlineComment.WrongStyle throws an error on each of them:

FILE: \drupal\core\lib\Drupal\Component\FileSystem\RegexDirectoryIterator.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
 36 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
    |       |     (Drupal.Commenting.InlineComment.WrongStyle)
 37 | ERROR | [x] You must use "/**" style comments for a function comment
    |       |     (Drupal.Commenting.FunctionComment.WrongStyle)
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

[snipped]

drupal\core\lib\Drupal\Component\FileSystem\RegexDirectoryIterator.php lines 33-37:

  /**
   * Implements \FilterIterator::accept().
   */
  #[\ReturnTypeWillChange]
  public function accept() {

Steps to reproduce

Run phpcs -s from the core directory

Proposed resolution

Allow [\ReturnTypeWillChange] in sniff "Drupal.Commenting.InlineComment.WrongStyle

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork coder-3250986

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Spokje created an issue. See original summary.

spokje’s picture

Title: SNiff "Drupal.Commenting.InlineComment.WrongStyle" doesný like #[\ReturnTypeWillChange] » Sniff "Drupal.Commenting.InlineComment.WrongStyle" doesný like #[\ReturnTypeWillChange]
Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Title: Sniff "Drupal.Commenting.InlineComment.WrongStyle" doesný like #[\ReturnTypeWillChange] » Sniff "Drupal.Commenting.InlineComment.WrongStyle" doesn't like #[\ReturnTypeWillChange]
claudiu.cristea’s picture

claudiu.cristea’s picture

Status: Active » Needs review

Needs review & test enabling on GitHub https://github.com/pfrenssen/coder/pull/157

klausi’s picture

Status: Needs review » Fixed

Merged, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.