mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 15:18:17 +01:00
Add Node::setAttributes() (#385)
This commit is contained in:
parent
92275bdfa8
commit
b1af3d1f7d
@ -71,9 +71,16 @@ interface Node
|
||||
public function &getAttribute(string $key, $default = null);
|
||||
|
||||
/**
|
||||
* Returns all attributes for the given node.
|
||||
* Returns all the attributes of this node.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes() : array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all the attributes of this node.
|
||||
*
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function setAttributes(array $attributes);
|
||||
}
|
||||
|
@ -163,6 +163,20 @@ class NodeAbstractTest extends TestCase
|
||||
),
|
||||
$node->getAttributes()
|
||||
);
|
||||
|
||||
$node->setAttributes(
|
||||
array(
|
||||
'a' => 'b',
|
||||
'c' => null,
|
||||
)
|
||||
);
|
||||
$this->assertSame(
|
||||
array(
|
||||
'a' => 'b',
|
||||
'c' => null,
|
||||
),
|
||||
$node->getAttributes()
|
||||
);
|
||||
}
|
||||
|
||||
public function testJsonSerialization() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user