Fix new coding standard issues due to rule changes in Coder 8.3.25

Created on 9 October 2024, about 1 month ago

In drupal/coder 8.3.25 some code style rules were changed, including that use statements should be sorted alphabetically case sensitively. Previously the use statements needed to be sorted case insensitively.

There is also a coding standard for parameters with null as default value, but not marked as nullable.

Let's try to fix the code.

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇳🇱Netherlands megachriz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @megachriz
  • Merge request !197Resolve #3479571 "Phpcs" → (Merged) created by megachriz
  • Pipeline finished with Skipped
    about 1 month ago
    #304990
    • megachriz committed e08bd893 on 8.x-3.x
      Issue #3479571 by megachriz: Fixed new coding standard issues due to...
  • 🇳🇱Netherlands megachriz

    Luckily no test failures! I merged the code.

  • 🇮🇳India zartab farooquee

    You need to ensure that all use statements are sorted in a case-sensitive manner.

    Before:
    use Drupal\Core\Entity\EntityTypeInterface;
    use Drupal\Core\Session\AccountInterface;
    use Drupal\feeds\FeedsEntity;

    After:
    use Drupal\feeds\FeedsEntity;
    use Drupal\Core\Entity\EntityTypeInterface;
    use Drupal\Core\Session\AccountInterface;

    For parameters that have null as a default value but are not marked as nullable, you need to update the function signatures. The PHP 7.1+ syntax allows you to explicitly mark parameters as nullable using the ? operator.
    Before:
    public function exampleFunction($param = null) {

    }
    After:
    public function exampleFunction(?string $param = null) {

    }

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

Production build 0.71.5 2024