Drupal.Functions.MultiLineFunctionDeclaration adds orphan comma(s)

Created on 4 August 2024, 5 months ago

Problem/Motivation

Drupal.Functions.MultiLineFunctionDeclaration generates broken code.

Steps to reproduce

1. Create a code file a.php:

<?php

function a(
): void {
}

2. Run the phpcbf:

phpcbf --standard=Drupal --sniffs=Drupal.Functions.MultiLineFunctionDeclaration ./a.php

3. Observe the resulting file:

<?php

function a(
  ,
): void {
}

Proposed resolution

Don't add comma(s) if a function contains no arguments.

🐛 Bug report
Status

Active

Version

8.3

Component

Coder Sniffer

Created by

🇪🇪Estonia ragnarkurm

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

Comments & Activities

Production build 0.71.5 2024