Lines Too Long
debt(d1/e1/b1/t3)
Closest to 'caught instantly' (d1), because phpcs, php-cs-fixer, and editorconfig (all listed in detection_hints.tools) flag long lines automatically and immediately — detection is fully automated with zero ambiguity.
Closest to 'one-line patch or single-call swap' (e1), because the quick_fix states php-cs-fixer's line_length rule enforces it automatically; in the worst case a developer wraps a fluent chain or array literal, which is a trivial local edit with no cross-file impact.
Closest to 'minimal commitment' (b1), because this is a pure style/formatting convention scoped to individual lines; it imposes no structural weight on the codebase, no architectural coupling, and no ongoing productivity tax beyond the initial formatter configuration.
Closest to 'minor surprise' (t3), because the misconception field identifies one real but mild gotcha — developers assume wide monitors make line limits obsolete — but the concept itself is straightforward and the surprise is limited to that one edge-of-relevance argument rather than a behavioural contradiction.
Also Known As
TL;DR
Explanation
Long lines arise from deep nesting, long method chains, or verbose expressions. PSR-2 recommended 80 chars; PSR-12 sets a soft limit of 120 with a hard limit of no restriction. In practice most teams enforce 120-160 chars in PHP-CS-Fixer. Long lines are a symptom of deeper issues: deep nesting (extract methods), long chains (intermediate variables), or large expression trees (decompose). PHP-CS-Fixer cannot auto-break long lines but warns about them.
Common Misconception
Why It Matters
Common Mistakes
- Fluent chains without line breaks between methods.
- Long if conditions without parenthetical grouping across multiple lines.
- Array literals on a single line with many elements.
- SQL strings on one line — break SQL across multiple lines with a heredoc or concatenation.
Code Examples
// Single line — hard to read, breaks diffs:
$users = $this->userRepository->findAll()->filter(fn($u) => $u->isActive())->sortBy('name')->take(50)->map(fn($u) => $u->toArray());
if ($user->isAdmin() && $user->hasPermission('write') && $resource->isOwnedBy($user) && !$resource->isLocked()) {
// Line breaks at logical points:
$users = $this->userRepository
->findAll()
->filter(fn($u) => $u->isActive())
->sortBy('name')
->take(50)
->map(fn($u) => $u->toArray());
if (
$user->isAdmin()
&& $user->hasPermission('write')
&& $resource->isOwnedBy($user)
&& !$resource->isLocked()
) {