Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Phug/Ast/Ast/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Node implements NodeInterface
* @param NodeInterface $parent
* @param array $children
*/
public function __construct(NodeInterface $parent = null, array $children = null)
public function __construct(?NodeInterface $parent = null, ?array $children = null)
{
$this->parent = null;
$this->children = [];
Expand Down Expand Up @@ -77,7 +77,7 @@ public function getParent()
/**
* {@inheritdoc}
*/
public function setParent(NodeInterface $parent = null)
public function setParent(?NodeInterface $parent = null)
{
if ($this->parent === $parent) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Phug/Compiler/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public function getBlocks()
*
* @return ElementInterface
*/
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$nodeEvent = new NodeEvent($node);
$this->trigger($nodeEvent);
Expand Down Expand Up @@ -537,7 +537,7 @@ public function compileNode(NodeInterface $node, ElementInterface $parent = null
* @param BlockElement $block
* @param array $children
*/
public function replaceBlock(BlockElement $block, array $children = null)
public function replaceBlock(BlockElement $block, ?array $children = null)
{
if ($parent = $block->getParent()) {
foreach (array_reverse($children ?: $block->getChildren()) as $child) {
Expand Down
8 changes: 4 additions & 4 deletions src/Phug/Compiler/Compiler/AbstractNodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getCompiler()
*
* @return ElementInterface[]
*/
public function getCompiledNodeList($nodeList, ElementInterface $element = null)
public function getCompiledNodeList($nodeList, ?ElementInterface $element = null)
{
return array_values(array_filter(array_map(
function (NodeInterface $childNode) use ($element) {
Expand All @@ -59,7 +59,7 @@ function (NodeInterface $childNode) use ($element) {
*
* @return ElementInterface[]
*/
public function getCompiledChildren(NodeInterface $node, ElementInterface $element = null)
public function getCompiledChildren(NodeInterface $node, ?ElementInterface $element = null)
{
return $this->getCompiledNodeList($node->getChildren(), $element);
}
Expand All @@ -71,7 +71,7 @@ public function getCompiledChildren(NodeInterface $node, ElementInterface $eleme
* @param NodeInterface $node
* @param ElementInterface|null $element
*/
public function compileNodeChildren(NodeInterface $node, ElementInterface $element = null)
public function compileNodeChildren(NodeInterface $node, ?ElementInterface $element = null)
{
$children = array_filter($node->getChildren());
array_walk($children, function (NodeInterface $childNode) use ($element) {
Expand Down Expand Up @@ -109,7 +109,7 @@ protected function getTextChildren(ParserNodeInterface $node)
}, $children));
}

private function compileParserNode(NodeInterface $node, ElementInterface $element = null)
private function compileParserNode(NodeInterface $node, ?ElementInterface $element = null)
{
return $node instanceof ParserNodeInterface
? $this->getCompiler()->compileNode($node, $element)
Expand Down
6 changes: 3 additions & 3 deletions src/Phug/Compiler/Compiler/Element/BlockElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class BlockElement extends AbstractElement
public function __construct(
CompilerInterface $compiler,
$name = '',
ParserNode $originNode = null,
NodeInterface $parent = null,
array $children = null
?ParserNode $originNode = null,
?NodeInterface $parent = null,
?array $children = null
) {
$blocks = &$compiler->getBlocksByName($name);
$blocks[] = $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class AssignmentListNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof AssignmentListNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class AssignmentNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof AssignmentNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class AttributeListNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof AttributeListNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function compileValue(AttributeNode $node)
return $value;
}

public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof AttributeNode,
Expand Down
6 changes: 3 additions & 3 deletions src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class BlockNodeCompiler extends AbstractNodeCompiler
{
protected function compileAnonymousBlock(BlockNode $node, ElementInterface $parent = null)
protected function compileAnonymousBlock(BlockNode $node, ?ElementInterface $parent = null)
{
$mixin = $node;
while ($mixin->hasParent() && !($mixin instanceof MixinNode)) {
Expand All @@ -38,7 +38,7 @@ protected function hasBlockParent(BlockNode $node)
return false;
}

protected function compileNamedBlock($name, BlockNode $node, ElementInterface $parent = null)
protected function compileNamedBlock($name, BlockNode $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$layout = $compiler->getLayout();
Expand All @@ -63,7 +63,7 @@ protected function compileNamedBlock($name, BlockNode $node, ElementInterface $p
);
}

public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof BlockNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class CaseNodeCompiler extends AbstractStatementNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof CaseNode,
Expand Down
4 changes: 2 additions & 2 deletions src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class CodeNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof CodeNode,
Expand Down Expand Up @@ -42,7 +42,7 @@ public function compileNode(NodeInterface $node, ElementInterface $parent = null
return $code;
}

private function getCodeElement(CodeNode $node, array $texts, array $children, ElementInterface $parent = null)
private function getCodeElement(CodeNode $node, array $texts, array $children, ?ElementInterface $parent = null)
{
if (count($texts) === count($children)) {
return new CodeElement($this->getTextChildren($node), $node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CommentNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof CommentNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ConditionalNodeCompiler extends AbstractStatementNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();

Expand Down
2 changes: 1 addition & 1 deletion src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class DoNodeCompiler extends AbstractStatementNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof DoNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class DoctypeNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class DocumentNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof DocumentNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function compileLoop(NodeInterface $node, $items, $key, $item)
return $loop;
}

public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof EachNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class ElementNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class ExpressionNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof ExpressionNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function compileText($name, $children, $parent, $indentLevel)
}, $children));
}

public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ForNodeCompiler extends EachNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof ForNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function isPugImport($path)
*
* @return null|ElementInterface
*/
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class KeywordNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof KeywordNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class MixinCallNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null)
public function compileNode(ParserNodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class MixinNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class TextNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof TextNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class VariableNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class WhenNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$this->getCompiler()->assert(
$node instanceof WhenNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class WhileNodeCompiler extends AbstractStatementNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class YieldNodeCompiler extends AbstractNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$compiler = $this->getCompiler();
$compiler->assert(
Expand Down
8 changes: 4 additions & 4 deletions src/Phug/Compiler/Compiler/NodeCompilerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ interface NodeCompilerInterface
*
* @return array
*/
public function getCompiledNodeList($nodeList, ElementInterface $parent = null);
public function getCompiledNodeList($nodeList, ?ElementInterface $parent = null);

/**
* @param NodeInterface $node
* @param ElementInterface $parent
*
* @return array
*/
public function getCompiledChildren(NodeInterface $node, ElementInterface $parent = null);
public function getCompiledChildren(NodeInterface $node, ?ElementInterface $parent = null);

/**
* @param NodeInterface $node
* @param ElementInterface|null $element
*
* @return mixed
*/
public function compileNodeChildren(NodeInterface $node, ElementInterface $element = null);
public function compileNodeChildren(NodeInterface $node, ?ElementInterface $element = null);

/**
* @param ParserNodeInterface $node
* @param ElementInterface $parent
*
* @return null|BlockElement|ElementInterface
*/
public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null);
public function compileNode(ParserNodeInterface $node, ?ElementInterface $parent = null);

/**
* @return CompilerInterface
Expand Down
4 changes: 2 additions & 2 deletions src/Phug/Compiler/CompilerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getBlocks();
* @param BlockElement $block
* @param array $children
*/
public function replaceBlock(BlockElement $block, array $children = null);
public function replaceBlock(BlockElement $block, ?array $children = null);

/**
* @throws CompilerException
Expand Down Expand Up @@ -133,7 +133,7 @@ public function getCurrentImportPaths();
*
* @return null|ElementInterface
*/
public function compileNode(NodeInterface $node, ElementInterface $parent = null);
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null);

/**
* @param string $input
Expand Down
Loading
Loading