phpdoc_line_span does not normalize multiline DocBlock boundaries

Author: savinmikhailCreated Aug 12, 2026Updated Aug 12, 2026

Problem description

phpdoc_line_span configured with multi does not normalize a physically multiline DocBlock when an annotation shares a line with the opening and/or closing delimiter.

For example, this hybrid form is already considered multiline only because it contains more than one physical line:

php
/** @param string $first
 * @param string $second */
function example($first, $second): void {}

DocBlock::makeMultiLine() returns immediately when DocBlock::isMultiLine() is true, so the multi configuration leaves the boundary delimiters attached to annotations.

Expected behavior

With phpdoc_line_span configured as function: multi, the DocBlock should be normalized to:

php
/**
 * @param string $first
 * @param string $second
 */
function example($first, $second): void {}

This is a formatting concern separate from annotation ordering: it should happen even when the annotations are already in the desired order.

The single configuration should keep its existing behavior.

Minimal reproducer

bash
php-cs-fixer fix \
  --dry-run \
  --diff \
  --using-cache=no \
  --rules='{"phpdoc_line_span":{"function":"multi"}}' \
  reproduce.php

Environment

  • PHP CS Fixer: 3.95.19-DEV
  • PHP: 8.4.24

Source: PHP-CS-Fixer/PHP-CS-Fixer