Skip to content

Commit

Permalink
NeonAdapter::removeUnderscoreVisitor() checks if key doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 11, 2023
1 parent ccd6821 commit d552f6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DI/Config/Adapters/NeonAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ public function removeUnderscoreVisitor(Neon\Node $node)
$attr->key = $attr->key ?? new Neon\Node\LiteralNode((string) $i);
}

if ($attr->value instanceof Neon\Node\LiteralNode && $attr->value->value === '_') {
if ($attr->key === null && $attr->value instanceof Neon\Node\LiteralNode && $attr->value->value === '_') {
unset($node->attributes[$i]);
$index = true;

} elseif ($attr->value instanceof Neon\Node\LiteralNode && $attr->value->value === '...') {
} elseif ($attr->key === null && $attr->value instanceof Neon\Node\LiteralNode && $attr->value->value === '...') {
trigger_error("Replace ... with _ in configuration file '$this->file'.", E_USER_DEPRECATED);
unset($node->attributes[$i]);
$index = true;
Expand Down

0 comments on commit d552f6b

Please sign in to comment.