From e1f77901361f287c5b7d99b80c9ea8d3afe7d2cd Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 1 Nov 2022 22:49:27 +0100 Subject: [PATCH] Use ??= more --- Node/ArrayNode.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Node/ArrayNode.php b/Node/ArrayNode.php index a8d68f9..e1a3169 100644 --- a/Node/ArrayNode.php +++ b/Node/ArrayNode.php @@ -29,9 +29,7 @@ public function __construct() public function addElement(Node $value, Node $key = null) { - if (null === $key) { - $key = new ConstantNode(++$this->index); - } + $key ??= new ConstantNode(++$this->index); array_push($this->nodes, $key, $value); }