diff --git a/src/Phug/Ast/Ast/Node.php b/src/Phug/Ast/Ast/Node.php index 5dbdc8e9..7ed7aa64 100644 --- a/src/Phug/Ast/Ast/Node.php +++ b/src/Phug/Ast/Ast/Node.php @@ -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 = []; @@ -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; diff --git a/src/Phug/Compiler/Compiler.php b/src/Phug/Compiler/Compiler.php index 2a3f8eca..a998d086 100644 --- a/src/Phug/Compiler/Compiler.php +++ b/src/Phug/Compiler/Compiler.php @@ -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); @@ -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) { diff --git a/src/Phug/Compiler/Compiler/AbstractNodeCompiler.php b/src/Phug/Compiler/Compiler/AbstractNodeCompiler.php index 44b69d5e..17ca62a6 100644 --- a/src/Phug/Compiler/Compiler/AbstractNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/AbstractNodeCompiler.php @@ -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) { @@ -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); } @@ -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) { @@ -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) diff --git a/src/Phug/Compiler/Compiler/Element/BlockElement.php b/src/Phug/Compiler/Compiler/Element/BlockElement.php index 01760b93..5f63dc1e 100644 --- a/src/Phug/Compiler/Compiler/Element/BlockElement.php +++ b/src/Phug/Compiler/Compiler/Element/BlockElement.php @@ -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; diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentListNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentListNodeCompiler.php index 0c2796b7..422abe2c 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentListNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentListNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php index 74df6392..df486878 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/AttributeListNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/AttributeListNodeCompiler.php index 3ac88694..3e900d27 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/AttributeListNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/AttributeListNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php index 896c9145..1b560efd 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php index b841d51f..dbf97744 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php @@ -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)) { @@ -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(); @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/CaseNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/CaseNodeCompiler.php index 5ea95d92..0d6f5a1b 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/CaseNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/CaseNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php index ad3803e4..c2ca1018 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php @@ -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, @@ -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); diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/CommentNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/CommentNodeCompiler.php index 8c523caf..3308b24b 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/CommentNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/CommentNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/ConditionalNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/ConditionalNodeCompiler.php index 03b8c723..680e0df8 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/ConditionalNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/ConditionalNodeCompiler.php @@ -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(); diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php index 96a50022..0fdd3941 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/DoctypeNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/DoctypeNodeCompiler.php index 20cf4221..bfa63e19 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/DoctypeNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/DoctypeNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/DocumentNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/DocumentNodeCompiler.php index 5ce327de..429bcc7e 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/DocumentNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/DocumentNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/EachNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/EachNodeCompiler.php index 711340be..6becd93a 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/EachNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/EachNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php index e342b0e8..ad5e6b77 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/ExpressionNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/ExpressionNodeCompiler.php index 5f0ccd7d..ba0f175c 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/ExpressionNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/ExpressionNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php index 28168aac..daa61b08 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php index cd2a077c..3511369d 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php index 70434387..7d53017a 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/KeywordNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/KeywordNodeCompiler.php index 2abc3bf3..09daa8ee 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/KeywordNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/KeywordNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php index e59c085a..1aa123ea 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/MixinNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/MixinNodeCompiler.php index 0bde5c7c..d5e15be2 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/MixinNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/MixinNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/TextNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/TextNodeCompiler.php index 32777615..4cc4277c 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/TextNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/TextNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/VariableNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/VariableNodeCompiler.php index e8dde980..c673f884 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/VariableNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/VariableNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/WhenNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/WhenNodeCompiler.php index edffac6d..1c998bf7 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/WhenNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/WhenNodeCompiler.php @@ -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, diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/WhileNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/WhileNodeCompiler.php index 7e949cfd..95ccc02b 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/WhileNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/WhileNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompiler/YieldNodeCompiler.php b/src/Phug/Compiler/Compiler/NodeCompiler/YieldNodeCompiler.php index b9e102c0..97fa9f21 100644 --- a/src/Phug/Compiler/Compiler/NodeCompiler/YieldNodeCompiler.php +++ b/src/Phug/Compiler/Compiler/NodeCompiler/YieldNodeCompiler.php @@ -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( diff --git a/src/Phug/Compiler/Compiler/NodeCompilerInterface.php b/src/Phug/Compiler/Compiler/NodeCompilerInterface.php index 1522f816..02e15b49 100644 --- a/src/Phug/Compiler/Compiler/NodeCompilerInterface.php +++ b/src/Phug/Compiler/Compiler/NodeCompilerInterface.php @@ -16,7 +16,7 @@ interface NodeCompilerInterface * * @return array */ - public function getCompiledNodeList($nodeList, ElementInterface $parent = null); + public function getCompiledNodeList($nodeList, ?ElementInterface $parent = null); /** * @param NodeInterface $node @@ -24,7 +24,7 @@ public function getCompiledNodeList($nodeList, ElementInterface $parent = null); * * @return array */ - public function getCompiledChildren(NodeInterface $node, ElementInterface $parent = null); + public function getCompiledChildren(NodeInterface $node, ?ElementInterface $parent = null); /** * @param NodeInterface $node @@ -32,7 +32,7 @@ public function getCompiledChildren(NodeInterface $node, ElementInterface $paren * * @return mixed */ - public function compileNodeChildren(NodeInterface $node, ElementInterface $element = null); + public function compileNodeChildren(NodeInterface $node, ?ElementInterface $element = null); /** * @param ParserNodeInterface $node @@ -40,7 +40,7 @@ public function compileNodeChildren(NodeInterface $node, ElementInterface $eleme * * @return null|BlockElement|ElementInterface */ - public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null); + public function compileNode(ParserNodeInterface $node, ?ElementInterface $parent = null); /** * @return CompilerInterface diff --git a/src/Phug/Compiler/CompilerInterface.php b/src/Phug/Compiler/CompilerInterface.php index ff36a9ba..3d5335b7 100644 --- a/src/Phug/Compiler/CompilerInterface.php +++ b/src/Phug/Compiler/CompilerInterface.php @@ -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 @@ -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 diff --git a/src/Phug/Formatter/Formatter/AbstractElement.php b/src/Phug/Formatter/Formatter/AbstractElement.php index 6250c586..a9cd649a 100644 --- a/src/Phug/Formatter/Formatter/AbstractElement.php +++ b/src/Phug/Formatter/Formatter/AbstractElement.php @@ -20,7 +20,7 @@ abstract class AbstractElement extends Node implements ElementInterface * @param NodeInterface|null $parent * @param array|null $children */ - public function __construct(ParserNode $originNode = null, NodeInterface $parent = null, array $children = null) + public function __construct(?ParserNode $originNode = null, ?NodeInterface $parent = null, ?array $children = null) { $this->originNode = $originNode; diff --git a/src/Phug/Formatter/Formatter/AbstractFormat.php b/src/Phug/Formatter/Formatter/AbstractFormat.php index d49365cf..6ce9ae0e 100644 --- a/src/Phug/Formatter/Formatter/AbstractFormat.php +++ b/src/Phug/Formatter/Formatter/AbstractFormat.php @@ -77,7 +77,7 @@ abstract class AbstractFormat implements FormatInterface, OptionInterface */ private $debugCommentPattern = null; - public function __construct(Formatter $formatter = null) + public function __construct(?Formatter $formatter = null) { $patterns = [ 'class_attribute' => static::CLASS_ATTRIBUTE, @@ -1003,7 +1003,7 @@ protected function formatDocumentElement(DocumentElement $document) return $this->formatElementChildren($document, 0); } - protected function throwException($message, ElementInterface $element = null) + protected function throwException($message, ?ElementInterface $element = null) { $location = ($node = $element->getOriginNode()) && ($loc = $node->getSourceLocation()) ? clone $loc diff --git a/src/Phug/Formatter/Formatter/Element/AbstractValueElement.php b/src/Phug/Formatter/Formatter/Element/AbstractValueElement.php index 3146ebd1..43d841a9 100644 --- a/src/Phug/Formatter/Formatter/Element/AbstractValueElement.php +++ b/src/Phug/Formatter/Formatter/Element/AbstractValueElement.php @@ -21,9 +21,9 @@ abstract class AbstractValueElement extends AbstractElement */ public function __construct( $value = null, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/AnonymousBlockElement.php b/src/Phug/Formatter/Formatter/Element/AnonymousBlockElement.php index 0730e70b..0dc0e775 100644 --- a/src/Phug/Formatter/Formatter/Element/AnonymousBlockElement.php +++ b/src/Phug/Formatter/Formatter/Element/AnonymousBlockElement.php @@ -7,7 +7,7 @@ class AnonymousBlockElement extends ExpressionElement { - public function __construct(ParserNode $originNode = null, NodeInterface $parent = null, array $children = null) + public function __construct(?ParserNode $originNode = null, ?NodeInterface $parent = null, ?array $children = null) { parent::__construct('$__pug_children(get_defined_vars())', $originNode, $parent, $children); $this->uncheck(); diff --git a/src/Phug/Formatter/Formatter/Element/AssignmentElement.php b/src/Phug/Formatter/Formatter/Element/AssignmentElement.php index 2bbcd6a9..8456169a 100644 --- a/src/Phug/Formatter/Formatter/Element/AssignmentElement.php +++ b/src/Phug/Formatter/Formatter/Element/AssignmentElement.php @@ -31,11 +31,11 @@ class AssignmentElement extends AbstractElement implements AttributesInterface, */ public function __construct( $name, - SplObjectStorage $attributes = null, - AssignmentContainerInterface $container = null, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?SplObjectStorage $attributes = null, + ?AssignmentContainerInterface $container = null, + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/AttributeElement.php b/src/Phug/Formatter/Formatter/Element/AttributeElement.php index 9e929b17..b4baeead 100644 --- a/src/Phug/Formatter/Formatter/Element/AttributeElement.php +++ b/src/Phug/Formatter/Formatter/Element/AttributeElement.php @@ -27,9 +27,9 @@ class AttributeElement extends AbstractValueElement implements OrderableInterfac public function __construct( $name, $value, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/CodeElement.php b/src/Phug/Formatter/Formatter/Element/CodeElement.php index d240a77c..dfac2013 100644 --- a/src/Phug/Formatter/Formatter/Element/CodeElement.php +++ b/src/Phug/Formatter/Formatter/Element/CodeElement.php @@ -34,9 +34,9 @@ class CodeElement extends AbstractValueElement implements TransformableInterface */ public function __construct( $value = null, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($value, $originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/KeywordElement.php b/src/Phug/Formatter/Formatter/Element/KeywordElement.php index 7b3ad80b..518f2166 100644 --- a/src/Phug/Formatter/Formatter/Element/KeywordElement.php +++ b/src/Phug/Formatter/Formatter/Element/KeywordElement.php @@ -27,9 +27,9 @@ class KeywordElement extends AbstractElement public function __construct( $name, $value, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/MarkupElement.php b/src/Phug/Formatter/Formatter/Element/MarkupElement.php index a79cc2d4..694a3fec 100644 --- a/src/Phug/Formatter/Formatter/Element/MarkupElement.php +++ b/src/Phug/Formatter/Formatter/Element/MarkupElement.php @@ -32,10 +32,10 @@ class MarkupElement extends AbstractMarkupElement implements AttributesInterface public function __construct( $name, $autoClosed = false, - SplObjectStorage $attributes = null, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?SplObjectStorage $attributes = null, + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Element/VariableElement.php b/src/Phug/Formatter/Formatter/Element/VariableElement.php index 0438cb8a..26df0229 100644 --- a/src/Phug/Formatter/Formatter/Element/VariableElement.php +++ b/src/Phug/Formatter/Formatter/Element/VariableElement.php @@ -28,11 +28,11 @@ class VariableElement extends AbstractElement * @param array|null $children */ public function __construct( - CodeElement $variable = null, - ExpressionElement $expression = null, - ParserNode $originNode = null, - NodeInterface $parent = null, - array $children = null + ?CodeElement $variable = null, + ?ExpressionElement $expression = null, + ?ParserNode $originNode = null, + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($originNode, $parent, $children); diff --git a/src/Phug/Formatter/Formatter/Event/FormatEvent.php b/src/Phug/Formatter/Formatter/Event/FormatEvent.php index 30b0a8fc..07469a71 100644 --- a/src/Phug/Formatter/Formatter/Event/FormatEvent.php +++ b/src/Phug/Formatter/Formatter/Event/FormatEvent.php @@ -37,7 +37,7 @@ public function getElement() /** * @param ElementInterface $element */ - public function setElement(ElementInterface $element = null) + public function setElement(?ElementInterface $element = null) { $this->element = $element; } diff --git a/src/Phug/Formatter/Formatter/Format/HtmlFormat.php b/src/Phug/Formatter/Formatter/Format/HtmlFormat.php index a8588627..37d471df 100644 --- a/src/Phug/Formatter/Formatter/Format/HtmlFormat.php +++ b/src/Phug/Formatter/Formatter/Format/HtmlFormat.php @@ -11,7 +11,7 @@ class HtmlFormat extends XhtmlFormat const EXPLICIT_CLOSING_TAG = '<%s/>'; const BOOLEAN_ATTRIBUTE_PATTERN = ' %s'; - public function __construct(Formatter $formatter = null) + public function __construct(?Formatter $formatter = null) { parent::__construct($formatter); diff --git a/src/Phug/Formatter/Formatter/Format/XhtmlFormat.php b/src/Phug/Formatter/Formatter/Format/XhtmlFormat.php index d51e5150..d5d854f2 100644 --- a/src/Phug/Formatter/Formatter/Format/XhtmlFormat.php +++ b/src/Phug/Formatter/Formatter/Format/XhtmlFormat.php @@ -13,7 +13,7 @@ abstract class XhtmlFormat extends XmlFormat const DOCTYPE_LANGUAGE = 'html'; const SELF_CLOSING_TAG = '<%s />'; - public function __construct(Formatter $formatter = null) + public function __construct(?Formatter $formatter = null) { $this->setOptionsRecursive([ 'white_space_sensitive_tags' => [ diff --git a/src/Phug/Formatter/Formatter/Format/XmlFormat.php b/src/Phug/Formatter/Formatter/Format/XmlFormat.php index 757ade84..4a0c4e65 100644 --- a/src/Phug/Formatter/Formatter/Format/XmlFormat.php +++ b/src/Phug/Formatter/Formatter/Format/XmlFormat.php @@ -37,7 +37,7 @@ class XmlFormat extends AbstractFormat const BOOLEAN_ATTRIBUTE_PATTERN = ' %s="%s"'; const BUFFER_VARIABLE = '$__value'; - public function __construct(Formatter $formatter = null) + public function __construct(?Formatter $formatter = null) { parent::__construct($formatter); diff --git a/src/Phug/Formatter/Formatter/FormatInterface.php b/src/Phug/Formatter/Formatter/FormatInterface.php index bc0160f6..24c56615 100644 --- a/src/Phug/Formatter/Formatter/FormatInterface.php +++ b/src/Phug/Formatter/Formatter/FormatInterface.php @@ -11,7 +11,7 @@ interface FormatInterface { const DEFAULT_VARIABLES_VARIABLE_NAME = 'pug_vars'; - public function __construct(Formatter $formatter = null); + public function __construct(?Formatter $formatter = null); public function format($element); diff --git a/src/Phug/Formatter/Formatter/Partial/PatternTrait.php b/src/Phug/Formatter/Formatter/Partial/PatternTrait.php index 0ee4d2cd..2cbffad4 100644 --- a/src/Phug/Formatter/Formatter/Partial/PatternTrait.php +++ b/src/Phug/Formatter/Formatter/Partial/PatternTrait.php @@ -98,7 +98,7 @@ public function setPatterns($patterns) * * @return string */ - public function exportHelper($name, array $arguments = null) + public function exportHelper($name, ?array $arguments = null) { $this->requireHelper($name); diff --git a/src/Phug/Lexer/Lexer/AbstractToken.php b/src/Phug/Lexer/Lexer/AbstractToken.php index 5ff5390e..55f68b55 100644 --- a/src/Phug/Lexer/Lexer/AbstractToken.php +++ b/src/Phug/Lexer/Lexer/AbstractToken.php @@ -13,7 +13,7 @@ abstract class AbstractToken implements TokenInterface, HandleTokenInterface private $indentation; private $handled = false; - public function __construct(SourceLocationInterface $sourceLocation = null, $level = null, $indentation = null) + public function __construct(?SourceLocationInterface $sourceLocation = null, $level = null, $indentation = null) { $this->sourceLocation = $sourceLocation; $this->level = $level ?: 0; diff --git a/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php b/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php index ff6816c6..290f47e2 100644 --- a/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php +++ b/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php @@ -103,7 +103,7 @@ private function isExpressionPartial(Reader $reader, $expression) $this->isTruncatedValue($expression); } - private function getAttributeValue(Reader $reader, array $chars = null) + private function getAttributeValue(Reader $reader, ?array $chars = null) { $chars = $chars ?: [ ' ', "\t", "\n", ',', ')', '//', diff --git a/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php b/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php index 00ca2b48..a4cbb0f1 100644 --- a/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php +++ b/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php @@ -53,7 +53,7 @@ protected function formatIndentChar(State $state, $indentChar) return $indentChar; } - public function getIndentLevel(State $state, $maxLevel = INF, callable $getIndentChar = null) + public function getIndentLevel(State $state, $maxLevel = INF, ?callable $getIndentChar = null) { if ($maxLevel <= 0) { return 0; diff --git a/src/Phug/Lexer/Lexer/TokenInterface.php b/src/Phug/Lexer/Lexer/TokenInterface.php index 0ed57bbc..88ed4f88 100644 --- a/src/Phug/Lexer/Lexer/TokenInterface.php +++ b/src/Phug/Lexer/Lexer/TokenInterface.php @@ -6,7 +6,7 @@ interface TokenInterface { - public function __construct(SourceLocationInterface $sourceLocation = null, $level = null, $indentation = null); + public function __construct(?SourceLocationInterface $sourceLocation = null, $level = null, $indentation = null); /** * @return SourceLocationInterface|null diff --git a/src/Phug/Parser/Parser/Node.php b/src/Phug/Parser/Parser/Node.php index e23c375a..42053e83 100644 --- a/src/Phug/Parser/Parser/Node.php +++ b/src/Phug/Parser/Parser/Node.php @@ -34,11 +34,11 @@ class Node extends AstNode implements NodeInterface * @param TokenInterface $token the token that created the node */ public function __construct( - TokenInterface $token = null, - SourceLocationInterface $sourceLocation = null, + ?TokenInterface $token = null, + ?SourceLocationInterface $sourceLocation = null, $level = null, - NodeInterface $parent = null, - array $children = null + ?NodeInterface $parent = null, + ?array $children = null ) { parent::__construct($parent, $children); @@ -77,7 +77,7 @@ public function getToken() * * @return $this */ - public function setOuterNode(NodeInterface $node = null) + public function setOuterNode(?NodeInterface $node = null) { $this->outerNode = $node; diff --git a/src/Phug/Parser/Parser/State.php b/src/Phug/Parser/Parser/State.php index fd0cc676..562ca30e 100644 --- a/src/Phug/Parser/Parser/State.php +++ b/src/Phug/Parser/Parser/State.php @@ -101,7 +101,7 @@ class State implements OptionInterface, EventManagerInterface */ private $interpolationNodes; - public function __construct(Parser $parser, \Iterator $tokens, array $options = null) + public function __construct(Parser $parser, \Iterator $tokens, ?array $options = null) { $this->parser = $parser; $this->level = 0; @@ -329,7 +329,7 @@ private function getNamedHandler($handler) * * @return $this */ - public function handleToken(TokenInterface $token = null) + public function handleToken(?TokenInterface $token = null) { $token = $token ?: $this->getToken(); $className = get_class($token); @@ -534,7 +534,7 @@ public function parentNodeIs(array $classNames) * * @return Node The newly created node */ - public function createNode($className, TokenInterface $token = null) + public function createNode($className, ?TokenInterface $token = null) { if (!is_subclass_of($className, Node::class)) { throw new \InvalidArgumentException( @@ -630,7 +630,7 @@ public function store() * * @throws ParserException */ - public function throwException($message, $code = 0, TokenInterface $relatedToken = null, $previous = null) + public function throwException($message, $code = 0, ?TokenInterface $relatedToken = null, $previous = null) { $lexer = $this->parser->getLexer(); //This will basically check for a source location for this Node. The process is like: diff --git a/src/Phug/Parser/ParserException.php b/src/Phug/Parser/ParserException.php index a7bc809a..9ac517d4 100644 --- a/src/Phug/Parser/ParserException.php +++ b/src/Phug/Parser/ParserException.php @@ -17,7 +17,7 @@ public function __construct( SourceLocation $location, $message = '', $code = 0, - TokenInterface $relatedToken = null, + ?TokenInterface $relatedToken = null, $previous = null ) { parent::__construct($location, $message, $code, $previous); diff --git a/src/Phug/Phug/Phug/Partial/PluginEnablerTrait.php b/src/Phug/Phug/Phug/Partial/PluginEnablerTrait.php index 3974c421..c611d373 100644 --- a/src/Phug/Phug/Phug/Partial/PluginEnablerTrait.php +++ b/src/Phug/Phug/Phug/Partial/PluginEnablerTrait.php @@ -15,7 +15,7 @@ trait PluginEnablerTrait * * @throws PhugException */ - public static function enable(Renderer $renderer = null) + public static function enable(?Renderer $renderer = null) { if ($renderer) { static::activateOnRenderer($renderer); diff --git a/src/Phug/Reader/Reader.php b/src/Phug/Reader/Reader.php index 8b28ba24..844179d3 100644 --- a/src/Phug/Reader/Reader.php +++ b/src/Phug/Reader/Reader.php @@ -618,7 +618,7 @@ public function peekAlphaNumeric() * * @return bool whether it could be or not. */ - public function peekAlphaIdentifier(array $allowedChars = null) + public function peekAlphaIdentifier(?array $allowedChars = null) { $allowedChars = $allowedChars ?: ['_']; @@ -632,7 +632,7 @@ public function peekAlphaIdentifier(array $allowedChars = null) * * @return bool whether it could be or not. */ - public function peekIdentifier(array $allowedChars = null) + public function peekIdentifier(?array $allowedChars = null) { return $this->peekAlphaIdentifier($allowedChars) || $this->peekDigit(); } @@ -757,7 +757,7 @@ public function readIdentifier($prefix = null, $allowedChars = null) * * @return string|null the resulting string or null if none encountered. */ - public function readString(array $escapeSequences = null, $raw = false) + public function readString(?array $escapeSequences = null, $raw = false) { if (!$this->peekQuote()) { return; @@ -820,7 +820,7 @@ public function readString(array $escapeSequences = null, $raw = false) * * @return string|null the resulting expression or null, if none encountered. */ - public function readExpression(array $breaks = null, array $brackets = null) + public function readExpression(?array $breaks = null, ?array $brackets = null) { if (!$this->hasLength()) { return; diff --git a/src/Phug/Renderer/Renderer/Task/TasksGroup.php b/src/Phug/Renderer/Renderer/Task/TasksGroup.php index e1f413a1..1a168578 100644 --- a/src/Phug/Renderer/Renderer/Task/TasksGroup.php +++ b/src/Phug/Renderer/Renderer/Task/TasksGroup.php @@ -11,7 +11,7 @@ class TasksGroup protected $success = 0; protected $errorDetails = []; - public function __construct(Renderer $renderer = null) + public function __construct(?Renderer $renderer = null) { if ($renderer) { $this->renderer = $renderer; diff --git a/src/Phug/Util/Util/SandBox.php b/src/Phug/Util/Util/SandBox.php index 2ae952af..5ab5e694 100644 --- a/src/Phug/Util/Util/SandBox.php +++ b/src/Phug/Util/Util/SandBox.php @@ -23,7 +23,7 @@ class SandBox */ private $throwable; - public function __construct(callable $action, callable $errorInterceptor = null) + public function __construct(callable $action, ?callable $errorInterceptor = null) { set_error_handler($errorInterceptor ?: function ($number, $message, $file, $line) { if (error_reporting() & $number) {