You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PrettyPHP's default formatting is largely PSR-12 compliant, but there are some differences to address.
Parts of PSR-12, e.g. PascalCase class names, fall outside the scope of a formatter and won't be implemented, although exceptions are sometimes made (use import statements are already sorted by default, for example).
LF line endings
Indent of 4 spaces
Line length "SHOULD NOT" exceed 80 characters and "MUST" have a soft limit of 120 characters
One statement per line (PreserveOneLineStatements must not be enabled)
Blank lines after "header blocks" (SpaceDeclarations and SortImports mandatory):
<?php
file-level docblock (blank line only applied before namespace currently)
declare statements
namespace declaration
class use statements
function use statements
constant use statements
Allow breaking over multiple lines if every item is on its own line (NoMixedLists mandatory):
implements and extends interfaces
Trigger if a newline appears after implements or extends, not just between first two interfaces
Add a newline before the opening brace of an anonymous class with an interface list that wraps
Parameters in function declarations
Variables in anonymous function use declarations
Arguments in function calls
Statements in for loops
One-line declare at line 1 of files also containing markup: <?php declare(strict_types=1) ?>
Suppress newline before close tag even if present in source
Force newlines before and after control structure expressions split over multiple lines
Add whitespace between exception types in catch
Enforce newline before first method in multiline method chains
The text was updated successfully, but these errors were encountered:
PrettyPHP's default formatting is largely PSR-12 compliant, but there are some differences to address.
Parts of PSR-12, e.g.
PascalCase
class names, fall outside the scope of a formatter and won't be implemented, although exceptions are sometimes made (use
import statements are already sorted by default, for example).Line length "SHOULD NOT" exceed 80 characters and "MUST" have a soft limit of 120 charactersPreserveOneLineStatements
must not be enabled)SpaceDeclarations
andSortImports
mandatory):<?php
namespace
currently)declare
statementsnamespace
declarationuse
statementsuse
statementsuse
statementsNoMixedLists
mandatory):implements
andextends
interfacesimplements
orextends
, not just between first two interfacesclass
with an interface list that wrapsfunction
declarationsuse
declarationsfunction
callsfor
loopsdeclare
at line 1 of files also containing markup:<?php declare(strict_types=1) ?>
catch
The text was updated successfully, but these errors were encountered: