Prázdné řádky
Prázdné řádky jsou interpunkce kódu: oddělují hlavičku od kódu a metody od sebe, drží vlastnosti
pohromadě a komentář u toho, co popisuje. Sekce blankLines určuje, kolik jich na každém takovém místě má
být, od namespace a importů přes členy třídy a závorky bloku po příkazy jako return.
Každé z těch míst má vlastní klíč a hodnotou je počet řádků, rozsah nebo keep, které místo nechá,
jak je. Rozsah se hodí tam, kde snesete dvojí zápis: betweenMembers: 0-1 dovolí psát vlastnosti těsně pod sebe
i oddělené jedním řádkem, ale dva už ne. Počet mimo rozsah se posune k nejbližší povolené hodnotě.
blankLines:
afterImports: 1
bodyStart:
class: 0
function: 0
aroundMethods: 2
betweenMembers: 0-1
beforeStatement:
return: 1
Komentář na vlastních řádcích patří ke kódu pod ním, a proto se prázdné řádky počítají nad komentářem. Kam se lámou řádky u složených závorek, rozhoduje sekce braces; tahle sekce hlídá jen prázdné řádky kolem nich.
class Cart
{
private array $items = []; // Expected no blank line before the property, 1 found.
public function add(Item $item): void // Expected 2 blank lines before the method, 0 found.
{
$this->items[] = $item;
}
public function total(): int // Expected 2 blank lines before the method, 1 found.
{
return array_sum($this->items);
}
}
class Cart
{
private array $items = [];
public function add(Item $item): void
{
$this->items[] = $item;
}
public function total(): int
{
return array_sum($this->items);
}
}
blankLines.afterOpeningTag
After the line of <?php, which then carries no code but a declaration of strict_types that
file.strictTypes.position puts there; a file with markup outside PHP keeps its tag.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony 1, laravel 1 · pokrývá blank_line_after_opening_tag,
linebreak_after_opening_tag, PSR12.Files.FileHeader, PSR12.Files.OpenTag
blankLines:
afterOpeningTag: 1
<?php // Expected 1 blank line before the declare, 0 found.
declare(strict_types=1);
<?php
declare(strict_types=1);
Jestli declare(strict_types=1) stojí na řádku otevíracího tagu, nebo pod ním, rozhoduje
file.strictTypes.position; tenhle klíč pak hlídá jen odstup pod tím řádkem. Standard nette píše
deklaraci na řádek tagu.
blankLines.afterDeclare
After declare(...);, before whatever follows it but a namespace declaration.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony keep, laravel keep · pokrývá PSR12.Files.FileHeader
blankLines.beforeNamespace
Before the namespace declaration and, where a doc comment of the file stands above it, also between the two.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony 1, laravel 1 · pokrývá blank_lines_before_namespace,
PSR12.Files.FileHeader, SlevomatCodingStandard.Namespaces.NamespaceSpacing
blankLines:
beforeNamespace: 1
<?php
declare(strict_types=1);
namespace App; // Expected 1 blank line before the namespace, 0 found.
<?php
declare(strict_types=1);
namespace App;
blankLines.afterNamespace
After an unbraced namespace declaration.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony 1, laravel 1 · pokrývá blank_line_after_namespace,
PSR12.Files.FileHeader,
PSR2.Namespaces.NamespaceDeclaration, SlevomatCodingStandard.Namespaces.NamespaceSpacing
blankLines:
afterNamespace: 1
<?php
namespace App;
use App\Model\User; // Expected 1 blank line before the import, 0 found.
<?php
namespace App;
use App\Model\User;
blankLines.betweenImports
Between two imports of one kind, two of classes for instance.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel 0 · pokrývá
blank_line_between_import_groups, PSR12.Files.FileHeader
blankLines.betweenImportKinds
Between the imports of classes, functions and constants.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
0, symfony 1, laravel 1 · pokrývá
blank_line_between_import_groups, PSR12.Files.FileHeader
blankLines:
betweenImportKinds: 1
<?php
namespace App;
use App\Model\User;
use function App\format; // Expected 1 blank line before the import, 0 found.
<?php
namespace App;
use App\Model\User;
use function App\format;
blankLines.afterImports
After the last import, before the rest of the code.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony 1, laravel 1 · pokrývá single_line_after_imports,
PSR12.Files.FileHeader, PSR2.Namespaces.UseDeclaration
blankLines:
afterImports: 1
<?php
namespace App;
use App\Model\User;
$user = new User; // Expected 1 blank line before the statement, 0 found.
<?php
namespace App;
use App\Model\User;
$user = new User;
blankLines.beforeDeclaration
Before a class, interface, trait, enum or function that follows the namespace or the imports, which afterNamespace
and afterImports then leave alone.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
2, symfony 1, laravel 1 · pokrývá blank_line_after_namespace,
single_line_after_imports, PSR12.Files.FileHeader,
PSR2.Namespaces.NamespaceDeclaration, PSR2.Namespaces.UseDeclaration
Nette Coding Standard tu chce dva řádky, aby deklarace stála od hlavičky dál než ostatní kód. Kde je klíč
keep, řídí se deklarace klíči afterNamespace a afterImports stejně jako
ostatní kód.
blankLines:
beforeDeclaration: 2
<?php
namespace App;
use App\Model\User;
class Cart // Expected 2 blank lines before the class, 1 found.
{
}
<?php
namespace App;
use App\Model\User;
class Cart
{
}
blankLines.aroundDeclarations
Before and after a class, interface, trait, enum or function declared among statements, where the header above it does not decide.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
1-2, symfony 0-1, laravel keep ·
pokrývá Squiz.WhiteSpace.FunctionSpacing
Patří sem i deklarace uvnitř podmínky. Standard nette dovoluje jeden nebo dva řádky, symfony
žádný nebo jeden.
blankLines:
aroundDeclarations: 2
function format(string $s): string
{
return trim($s);
}
class Cart // Expected 2 blank lines before the class, 0 found.
{
}
echo format('x'); // Expected 2 blank lines after the class, 0 found.
function format(string $s): string
{
return trim($s);
}
class Cart
{
}
echo format('x');
blankLines.beforeOpenBrace.class
Between the head of a class, an interface, a trait or an enum and its opening brace on a line of its own.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep
blankLines.bodyStart.function
After the opening brace of the body of a function or a method.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0, symfony keep, laravel keep ·
pokrývá Squiz.WhiteSpace.FunctionOpeningBraceSpace
blankLines:
bodyStart:
function: 0
function add(Item $item): void
{
$this->items[] = $item; // Expected no blank line after the opening brace, 1 found.
}
function add(Item $item): void
{
$this->items[] = $item;
}
blankLines.bodyStart.closure
After the opening brace of the body of a closure.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0, symfony keep, laravel keep ·
pokrývá Squiz.WhiteSpace.FunctionOpeningBraceSpace
blankLines.bodyStart.propertyHook
After the opening brace of the body of a property hook.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0, symfony keep, laravel keep
blankLines.bodyStart.controlStructure
After the opening brace of the body of if, else, a loop, switch, match,
try, catch, finally, declare and of a bare block.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep ·
pokrývá Squiz.WhiteSpace.ControlStructureSpacing
blankLines.bodyStart.switchCase
After the colon of a case or default of a switch, before its first statement.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
keep, symfony keep, laravel keep
blankLines.bodyStart.class
After the opening brace of a class, an interface, a trait or an enum, before its first member.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel 0 · pokrývá no_blank_lines_after_class_opening,
PSR12.Classes.OpeningBraceSpace, PSR12.Traits.UseDeclaration,
SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces, Squiz.WhiteSpace.FunctionSpacing
blankLines:
bodyStart:
class: 1
class Cart
{
public function add(Item $item): void // Expected 1 blank line before the method, 0 found.
{
}
}
class Cart
{
public function add(Item $item): void
{
}
}
blankLines.bodyStart.anonymousClass
After the opening brace of an anonymous class, before its first member.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel 0 · pokrývá no_blank_lines_after_class_opening,
PSR12.Classes.OpeningBraceSpace, SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces
blankLines.bodyEnd.class
Before the closing brace of a class, an interface, a trait or an enum, after its last member.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep · pokrývá PSR12.Traits.UseDeclaration,
SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces, Squiz.WhiteSpace.FunctionSpacing
blankLines:
bodyEnd:
class: 1
class Cart
{
public function add(Item $item): void
{
}
} // Expected 1 blank line after the method, 0 found.
class Cart
{
public function add(Item $item): void
{
}
}
blankLines.bodyEnd.anonymousClass
Before the closing brace of an anonymous class, after its last member.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep ·
pokrývá SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces
blankLines.bodyEnd.function
Before the closing brace of the body of a function or a method.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep · pokrývá PSR2.Methods.FunctionClosingBrace
Prázdný řádek před } větve, za kterou následuje } catch nebo } else, bývá
záměrným oddělovačem větví; o něm rozhoduje blankLines.bodyEnd.branch.
blankLines:
bodyEnd:
function: 0
function add(Item $item): void
{
$this->items[] = $item;
} // Expected no blank line before the closing brace, 1 found.
function add(Item $item): void
{
$this->items[] = $item;
}
blankLines.bodyEnd.closure
Before the closing brace of the body of a closure.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep · pokrývá PSR2.Methods.FunctionClosingBrace
blankLines.bodyEnd.propertyHook
Before the closing brace of the body of a property hook.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0, symfony keep, laravel keep
blankLines.bodyEnd.controlStructure
Before the closing brace of the body of if, else, a loop, switch, match,
try, catch, finally, declare and of a bare block.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony 0, laravel keep ·
pokrývá Squiz.WhiteSpace.ControlStructureSpacing
blankLines.bodyEnd.branch
Before the closing brace of a branch of if or try that else, elseif,
catch or finally follows, and of the body of do that while follows, which
lastStatementSetApart keeps as it is, in place of bodyEnd.controlStructure.
- počet od 0, rozsah
1-2nebo otevřený1+ lastStatementSetApart: one where the last statement of the branch stands apart, which would otherwise read as belonging to the next one, the others keptkeep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
lastStatementSetApart, symfony 0, laravel keep
Hodnota lastStatementSetApart dá prázdný řádek na konec větve, jejíž poslední příkaz je od
předchozích oddělený prázdným řádkem; bez něj by se takový příkaz opticky přilepil k } else pod sebou.
Ostatní větve téhož řetězu nechá, jak jsou. Tuto hodnotu volí nette.
blankLines:
bodyEnd:
branch: lastStatementSetApart
if ($order->isPaid()) {
$this->ship($order);
return;
} elseif ($order->isExpired()) { // Expected 1 blank line before the closing brace, 0 found.
$this->cancel($order);
} else {
$this->remind($order);
}
if ($order->isPaid()) {
$this->ship($order);
return;
} elseif ($order->isExpired()) {
$this->cancel($order);
} else {
$this->remind($order);
}
blankLines.bodyEnd.switchCase
Before a case or default of a switch that follows a case with statements, below a
comment right under those statements.
- počet od 0, rozsah
1-2nebo otevřený1+ lastStatementSetApart: one where the last statement of the branch stands apart, which would otherwise read as belonging to the next one, the others keptkeep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
lastStatementSetApart, symfony keep, laravel keep
Skupina case 1: case 2: bez příkazů zůstává pohromadě. Komentář hned pod příkazy, třeba
// no break, patří k případu nad ním, takže prázdný řádek jde pod něj; komentář oddělený prázdným
řádkem patří k case pod ním.
blankLines:
bodyEnd:
switchCase: lastStatementSetApart
switch ($status) {
case Status::New:
$this->validate($order);
break;
case Status::Paid: // Expected 1 blank line before the case, 0 found.
$this->ship($order);
break;
}
switch ($status) {
case Status::New:
$this->validate($order);
break;
case Status::Paid:
$this->ship($order);
break;
}
blankLines.betweenTraitUses
Between the trait uses of a class without a doc comment, the blank lines below a documented one staying as they are.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 0, nette
0, symfony keep, laravel 0 · pokrývá class_attributes_separation,
PSR12.Traits.UseDeclaration, SlevomatCodingStandard.Classes.TraitUseSpacing
blankLines:
betweenTraitUses: 0
class Cart
{
use Countable;
use Serializable; // Expected no blank line before the trait use, 1 found.
}
class Cart
{
use Countable;
use Serializable;
}
blankLines.afterTraitUses
Before the first member after the trait uses, a method included.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 1, psr12 1, nette
1, symfony keep, laravel keep · pokrývá
PSR12.Traits.UseDeclaration, SlevomatCodingStandard.Classes.TraitUseSpacing
blankLines:
afterTraitUses: 1
class Cart
{
use Countable;
private array $items = []; // Expected 1 blank line before the property, 0 found.
}
class Cart
{
use Countable;
private array $items = [];
}
blankLines.betweenMembers.constant
Between two constants, the lower one without a doc comment or an attribute.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0-1, symfony keep, laravel 1 · pokrývá
class_attributes_separation, SlevomatCodingStandard.Classes.ConstantSpacing
blankLines.betweenMembers.property
Between two properties, the lower one without a doc comment or an attribute.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0-1, symfony keep, laravel 1 · pokrývá
class_attributes_separation, SlevomatCodingStandard.Classes.PropertySpacing
blankLines.betweenMembers.enumCase
Between two enum cases, the lower one without a doc comment or an attribute.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0-1, symfony keep, laravel keep · pokrývá
class_attributes_separation, SlevomatCodingStandard.Classes.EnumCaseSpacing
blankLines.betweenMemberKinds
Between a property, a constant and an enum case of different kinds, the visibility and static making no kind of
their own, the lower one without a doc comment or an attribute.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0-1, symfony keep, laravel 1 · pokrývá class_attributes_separation,
SlevomatCodingStandard.Classes.ClassMemberSpacing, SlevomatCodingStandard.Classes.ConstantSpacing,
SlevomatCodingStandard.Classes.EnumCaseSpacing, SlevomatCodingStandard.Classes.PropertySpacing
blankLines.beforeDocumentedMember
Before a property, constant or enum case with a doc comment or an attribute, and before a trait use with a doc comment below another one.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
1, symfony keep, laravel 1 · pokrývá class_attributes_separation,
SlevomatCodingStandard.Classes.ConstantSpacing,
SlevomatCodingStandard.Classes.EnumCaseSpacing, SlevomatCodingStandard.Classes.PropertySpacing
Dokumentační komentář potřebuje odstup od předchozího člena, aby bylo vidět, ke kterému patří.
blankLines:
beforeDocumentedMember: 1
class Cart
{
private array $items = [];
/** @var int<0, max> */
private int $count = 0; // Expected 1 blank line before the property, 0 found.
}
class Cart
{
private array $items = [];
/** @var int<0, max> */
private int $count = 0;
}
blankLines.aroundMethods
Before and after a method; the first and the last member of a class take bodyStart.class and
bodyEnd.class.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
2, symfony 1, laravel 1 · pokrývá class_attributes_separation,
SlevomatCodingStandard.Classes.MethodSpacing, Squiz.WhiteSpace.FunctionSpacing
blankLines:
aroundMethods: 1
class Cart
{
public function add(Item $item): void
{
}
public function total(): int // Expected 1 blank line before the method, 2 found.
{
}
}
class Cart
{
public function add(Item $item): void
{
}
public function total(): int
{
}
}
blankLines.aroundInterfaceMethods
Before and after a method of an interface, in place of aroundMethods.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
1, symfony 1, laravel 1 · pokrývá class_attributes_separation,
SlevomatCodingStandard.Classes.MethodSpacing, Squiz.WhiteSpace.FunctionSpacing
Metody rozhraní nemají tělo, proto jim stačí menší odstup než metodám třídy.
blankLines:
aroundInterfaceMethods: 0
interface Storage
{
public function read(string $key): mixed;
public function write(string $key, mixed $value): void; // Expected no blank line before the method, 1 found.
}
interface Storage
{
public function read(string $key): mixed;
public function write(string $key, mixed $value): void;
}
blankLines.betweenStatementsInFunction
Between two statements in the body of a function, a method or a closure, at any depth; a count of the kind of the statement before or after narrows it.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
0-2, symfony keep, laravel keep
blankLines.beforeStatement
Before a statement of the kind, yield meaning a statement made of a yield expression.
- mapa
break,continue,do,for,foreach,if,return,switch,throw,try,while,yieldna hodnotu z následujících, položka se odvolá hodnotoukeep:- počet od 0, rozsah
1-2nebo otevřený1+
- počet od 0, rozsah
keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
keep, symfony {return: '1+'}, laravel {continue: '1+', return: '1+'} · pokrývá
blank_line_before_statement,
SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing, SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing
Klíč se neuplatní, když je sousedním příkazem deklarace třídy nebo funkce, use, namespace,
declare nebo HTML mimo PHP tagy; odstup od nich řídí klíče hlavičky a aroundDeclarations.
Příkaz, který je v těle první, se řídí klíči bodyStart.
blankLines:
beforeStatement:
return: 1+
function total(array $items): int
{
$sum = array_sum($items);
return $sum; // Expected at least 1 blank line before the return, 0 found.
}
function total(array $items): int
{
$sum = array_sum($items);
return $sum;
}
blankLines.afterStatement
After a statement of the kind, before the next statement.
- mapa
break,continue,do,for,foreach,if,return,switch,throw,try,while,yieldna hodnotu z následujících, položka se odvolá hodnotoukeep:- počet od 0, rozsah
1-2nebo otevřený1+
- počet od 0, rozsah
keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
keep, symfony keep, laravel keep · pokrývá
SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing,
SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing, Squiz.WhiteSpace.ControlStructureSpacing
blankLines:
afterStatement:
if: 1
if ($item->isFree()) {
return;
}
$this->items[] = $item; // Expected 1 blank line after the if, 0 found.
if ($item->isFree()) {
return;
}
$this->items[] = $item;
blankLines.afterPhpdoc
Between a doc comment and the declaration it belongs to, or the first attribute of the declaration.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 keep, nette
0, symfony 0, laravel 0 · pokrývá no_blank_lines_after_phpdoc
Dokumentační komentář hned za <?php na začátku souboru patří souboru, takže se ho klíč netýká.
blankLines:
afterPhpdoc: 0
class Cart
{
/**
* Adds an item.
*/
public function add(Item $item): void // Expected no blank line after the doc comment, 1 found.
{
}
}
class Cart
{
/**
* Adds an item.
*/
public function add(Item $item): void
{
}
}
blankLines.belowComment.inlineVar
Between a doc comment with @var and the statement below it that is no declaration,
/** @var Order $order */.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs keep, psr12 keep, nette
keep, symfony 0, laravel keep
blankLines.afterAttributes
Between the last group of attributes and the declaration, the member, the parameter or the closure it belongs to.
- počet od 0, rozsah
1-2nebo otevřený1+ keep: nic se nevynucuje, kód zůstane, jak je
Výchozí keep · standardy: perCs 0, psr12 keep, nette
0, symfony 0, laravel keep ·
pokrývá SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing