Skip to content

CodeSpreader ​

php
final readonly class Zairakai\LaravelDevTools\Services\CodeSpreader

Writes on several lines what the handbook asks to spread (standards/php.md): every array that is not empty, a call of more than two arguments and a function of more than two parameters. One element, argument or parameter per line, a trailing comma, the indentation of the line. The destructurings ([$a, $b] = ...) and the list() and array() forms are left as they are.

Pint then aligns the =>. The source is returned unchanged when it cannot be parsed.

What to spread is found by ArrayEdits, CallEdits and ParameterEdits (one kind of node each); this class applies their edits, round after round, until nothing is left to spread.

Source: src/Services/CodeSpreader.php

Methods ​

__construct() ​

php
public function __construct(Parser $parser = null)

spread() ​

php
public function spread(string $source): string

Returns string the source with its arrays and its calls spread, until nothing is left to spread

Documentation of 5.5.0 , built from 92a7387 on 5.5.0 by pipeline #3086393151 on 2026-11-18.