Skip to content

Commit 5b5bfb3

Browse files
committed
Fix ds:Transform
1 parent 4fa8f25 commit 5b5bfb3

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/XML/ds/Transform.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@
1616
*/
1717
final class Transform extends AbstractDsElement
1818
{
19-
/** @var \SimpleSAML\XML\Chunk[] */
20-
protected array $elements = [];
21-
2219
/** @var string */
2320
protected string $Algorithm;
2421

22+
/** @var \SimpleSAML\XML\Chunk[] */
23+
protected array $elements = [];
24+
2525

2626
/**
2727
* Initialize a ds:Transform
2828
*
29-
* @param \SimpleSAML\XML\Chunk[] $elements
3029
* @param string $Algorithm
30+
* @param \SimpleSAML\XML\Chunk[] $elements
3131
*/
32-
public function __construct(array $elements = [], string $Algorithm = 'http://www.w3.org/TR/1999/REC-xpath-19991116')
33-
{
32+
public function __construct(
33+
string $Algorithm,
34+
array $elements = []
35+
) {
3436
$this->setElements($elements);
3537
$this->setAlgorithm($Algorithm);
3638
}
@@ -117,7 +119,7 @@ public static function fromXML(DOMElement $xml): object
117119
$elements[] = new Chunk($element);
118120
}
119121

120-
return new self($elements, $Algorithm);
122+
return new self($Algorithm, $elements);
121123
}
122124

123125

tests/XML/ds/TransformTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function setUp(): void
4343
public function testMarshalling(): void
4444
{
4545
$transform = new Transform(
46+
'http://www.w3.org/TR/1999/REC-xpath-19991116',
4647
[
4748
new Chunk(DOMDocumentFactory::fromString('<some:Chunk>Random</some:Chunk>')->documentElement),
4849
new Chunk(DOMDocumentFactory::fromString('<ds:XPath>count(//. | //@* | //namespace::*)</ds:XPath>')->documentElement)
@@ -94,7 +95,7 @@ public function testUnmarshalling(): void
9495
public function testMarshallingEmptyElement(): void
9596
{
9697
$ds_ns = Transform::NS;
97-
$transform = new Transform([]);
98+
$transform = new Transform('http://www.w3.org/TR/1999/REC-xpath-19991116', []);
9899
$this->assertEquals(
99100
"<ds:Transform xmlns:ds=\"$ds_ns\" Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"/>",
100101
strval($transform)

0 commit comments

Comments
 (0)