function ParserAbstract::fixupArrayDestructuring
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ ParserAbstract.php, line 978
Class
Namespace
PhpParserCode
protected function fixupArrayDestructuring(Array_ $node) : Expr\List_ {
$this->createdArrays
->detach($node);
return new Expr\List_(array_map(function (Node\ArrayItem $item) {
if ($item->value instanceof Expr\Error) {
// We used Error as a placeholder for empty elements, which are legal for destructuring.
return null;
}
if ($item->value instanceof Array_) {
return new Node\ArrayItem($this->fixupArrayDestructuring($item->value), $item->key, $item->byRef, $item->getAttributes());
}
return $item;
}, $node->items), [
'kind' => Expr\List_::KIND_ARRAY,
] + $node->getAttributes());
}