Blank Lines

The blankLines section decides how many blank lines go wherever they matter: in the file header around namespace and the imports, between the methods and other members of a class, after the opening and before the closing brace of a block, and around statements like return.

Blank lines make a file readable at a glance: the header stands apart from the code, methods are clearly separated from each other, properties and constants stay together, and a comment stays attached to what it describes. Each such place has its own key. Its value is a number of lines, a range, or keep, which leaves the place as it is. A range is useful where you accept two styles: betweenMembers: 0-1 lets you write properties directly below each other or separated by one blank line, but not by two. A count outside the range is moved to the nearest allowed value.

blankLines:
	afterImports: 1
	bodyStart:
		class: 0
		function: 0
	aroundMethods: 2
	betweenMembers: 0-1
	beforeStatement:
		return: 1

Blank lines are counted above a comment that stands on its own lines above the code, because the comment belongs to the code below it. The braces section decides where lines break at braces; this section decides only the blank lines around them.

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.bodyStart.function

After the opening brace of the body of a function or a method.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0, symfony keep, laravel keep · covers 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.bodyEnd.function

Before the closing brace of the body of a function or a method.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers PSR2.Methods.FunctionClosingBrace

A blank line before the } of a branch that is followed by } catch or } else is often a deliberate separator between the branches; that one is decided by 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.bodyStart.closure

After the opening brace of the body of a closure.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0, symfony keep, laravel keep · covers Squiz.WhiteSpace.FunctionOpeningBraceSpace

blankLines.bodyEnd.closure

Before the closing brace of the body of a closure.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers PSR2.Methods.FunctionClosingBrace

blankLines.bodyStart.propertyHook

After the opening brace of the body of a property hook.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0, symfony keep, laravel keep

blankLines.bodyEnd.propertyHook

Before the closing brace of the body of a property hook.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers Squiz.WhiteSpace.ControlStructureSpacing

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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers Squiz.WhiteSpace.ControlStructureSpacing

blankLines.bodyStart.switchCase

After the colon of a case or default of a switch, before its first statement.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette keep, symfony keep, laravel keep

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.

  • a number from 0, a range 1-2 or an open one 1+
  • lastStatementSetApart: one where the last statement of the branch stands apart, which would otherwise read as belonging to the next one, the others kept
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette lastStatementSetApart, symfony 0, laravel keep

The value lastStatementSetApart puts a blank line after a branch whose last statement is separated from the previous ones by a blank line; without it, that statement would visually stick to the } else below it. The other branches of the same chain stay as they are. The nette standard chooses this value.

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.

  • a number from 0, a range 1-2 or an open one 1+
  • lastStatementSetApart: one where the last statement of the branch stands apart, which would otherwise read as belonging to the next one, the others kept
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette lastStatementSetApart, symfony keep, laravel keep

Labels with no statements between them, like case 1: case 2:, stay together. A comment directly below the statements, such as // no break, belongs to the case above it, so the blank line goes below the comment; a comment separated by a blank line belongs to the case below it.

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.afterPhpdoc

Between a doc comment and the declaration it belongs to, or the first attribute of the declaration.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 keep, nette 0, symfony 0, laravel 0 · covers no_blank_lines_after_phpdoc

A doc comment directly after <?php at the start of the file belongs to the file, so this key does not apply to it.

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.aroundMethods

Before and after a method; the first and the last member of a class take bodyStart.class and bodyEnd.class.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 2, symfony 1, laravel 1 · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 1, symfony 1, laravel 1 · covers class_attributes_separation, SlevomatCodingStandard.Classes.MethodSpacing, Squiz.WhiteSpace.FunctionSpacing

Interface methods have no body, so they need fewer blank lines between them than the methods of a class.

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.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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep

blankLines.bodyStart.class

After the opening brace of a class, an interface, a trait or an enum, before its first member.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel 0 · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel 0 · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel keep · covers SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces

blankLines.betweenTraitUses

Between the trait uses of a class without a doc comment, the blank lines below a documented one staying as they are.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony keep, laravel 0 · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony keep, laravel keep · covers 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.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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0-1, symfony keep, laravel 1 · covers class_attributes_separation, SlevomatCodingStandard.Classes.ClassMemberSpacing, SlevomatCodingStandard.Classes.ConstantSpacing, SlevomatCodingStandard.Classes.EnumCaseSpacing, SlevomatCodingStandard.Classes.PropertySpacing

blankLines.betweenMembers.constant

Between two constants, the lower one without a doc comment or an attribute.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0-1, symfony keep, laravel 1 · covers class_attributes_separation, SlevomatCodingStandard.Classes.ConstantSpacing

blankLines.betweenMembers.property

Between two properties, the lower one without a doc comment or an attribute.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0-1, symfony keep, laravel 1 · covers class_attributes_separation, SlevomatCodingStandard.Classes.PropertySpacing

blankLines.betweenMembers.enumCase

Between two enum cases, the lower one without a doc comment or an attribute.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0-1, symfony keep, laravel keep · covers class_attributes_separation, SlevomatCodingStandard.Classes.EnumCaseSpacing

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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 1, symfony keep, laravel 1 · covers class_attributes_separation, SlevomatCodingStandard.Classes.ConstantSpacing, SlevomatCodingStandard.Classes.EnumCaseSpacing, SlevomatCodingStandard.Classes.PropertySpacing

A doc comment needs blank lines above it, separating it from the previous member, so that you can see which member it belongs to.

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.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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony 1, laravel 1 · covers 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);

The decision file.strictTypes.position decides whether declare(strict_types=1) stands on the line of the opening tag or below it; this key then checks only the blank lines below that line. The nette standard writes the declaration on the line of the tag.

blankLines.afterDeclare

After declare(...);, before whatever follows it but a namespace declaration.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony keep, laravel keep · covers PSR12.Files.FileHeader

blankLines.beforeNamespace

Before the namespace declaration and, where a doc comment of the file stands above it, also between the two.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony 1, laravel 1 · covers 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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony 1, laravel 1 · covers 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.afterImports

After the last import, before the rest of the code.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 1, symfony 1, laravel 1 · covers 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.betweenImports

Between two imports of one kind, two of classes for instance.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 0, nette 0, symfony 0, laravel 0 · covers blank_line_between_import_groups, PSR12.Files.FileHeader

blankLines.betweenImportKinds

Between the imports of classes, functions and constants.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 0, symfony 1, laravel 1 · covers 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.beforeDeclaration

Before a class, interface, trait, enum or function that follows the namespace or the imports, which afterNamespace and afterImports then leave alone.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 1, psr12 1, nette 2, symfony 1, laravel 1 · covers blank_line_after_namespace, single_line_after_imports, PSR12.Files.FileHeader, PSR2.Namespaces.NamespaceDeclaration, PSR2.Namespaces.UseDeclaration

Nette Coding Standard wants two lines here, so that a declaration stands further from the header than other code does. Where the key is keep, a declaration follows the keys afterNamespace and afterImports, like the rest of the code.

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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 1-2, symfony 0-1, laravel keep · covers Squiz.WhiteSpace.FunctionSpacing

This includes a declaration inside a condition. The nette standard allows one or two lines, symfony none or one.

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.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.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette 0-2, symfony keep, laravel keep

blankLines.afterAttributes

Between the last group of attributes and the declaration, the member, the parameter or the closure it belongs to.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs 0, psr12 keep, nette 0, symfony 0, laravel keep · covers SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing

blankLines.belowComment.inlineVar

Between a doc comment with @var and the statement below it that is no declaration, /** @var Order $order */.

  • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette keep, symfony 0, laravel keep

blankLines.beforeStatement

Before a statement of the kind, yield meaning a statement made of a yield expression.

  • a map of break, continue, do, for, foreach, if, return, switch, throw, try, while, yield to one of the following values, an entry is withdrawn with the value keep:
    • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette keep, symfony {return: '1+'}, laravel {continue: '1+', return: '1+'} · covers blank_line_before_statement, SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing, SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing

The key does not apply when the neighboring statement is a declaration of a class or a function, a use, namespace or declare statement, or HTML outside the PHP tags; the blank lines around those are set by the header keys and by aroundDeclarations. A statement that is the first in a body follows the bodyStart keys.

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.

  • a map of break, continue, do, for, foreach, if, return, switch, throw, try, while, yield to one of the following values, an entry is withdrawn with the value keep:
    • a number from 0, a range 1-2 or an open one 1+
  • keep: nothing is enforced, the code stays as it is

Default keep · standards: perCs keep, psr12 keep, nette keep, symfony keep, laravel keep · covers 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;