From 4fd66d36cf20c432935045c59089bf97182390a1 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 3 Dec 2024 22:42:05 +0100 Subject: [PATCH] Add ds:SPKIData element --- src/XML/ds/AbstractSPKIDataType.php | 15 ++++++--------- tests/XML/ds/SPKIDataTest.php | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/XML/ds/AbstractSPKIDataType.php b/src/XML/ds/AbstractSPKIDataType.php index 5add02a3..46d3d0da 100644 --- a/src/XML/ds/AbstractSPKIDataType.php +++ b/src/XML/ds/AbstractSPKIDataType.php @@ -23,7 +23,7 @@ abstract class AbstractSPKIDataType extends AbstractDsElement /** * Initialize a SPKIData element. * - * @param array<\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, SimpleSAML\XML\SerializableElementInterface|null> $tuples + * @param array{array{\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null}} $tuples */ final public function __construct( protected array $tuples, @@ -32,9 +32,8 @@ final public function __construct( Assert::allCount($tuples, 2); foreach ($tuples as $tuple) { - list($spkisExp, $other) = $tuple; - Assert::isInstanceOf($spkisExp, SPKISexp::class, SchemaViolationException::class); - Assert::nullOrIsInstanceOf($other, SerializableElementInterface::class, SchemaViolationException::class); + Assert::isInstanceOf($tuple[0], SPKISexp::class, SchemaViolationException::class); + Assert::nullOrIsInstanceOf($tuple[1], SerializableElementInterface::class, SchemaViolationException::class); } } @@ -42,7 +41,7 @@ final public function __construct( /** * Collect the value of the SPKISexp-property * - * @return array<\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, SimpleSAML\XML\SerializableElementInterface|null> + * @return array{array{\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null}} */ public function getTuples(): array { @@ -102,10 +101,8 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); foreach ($this->getTuples() as $tuple) { - list($spkisExp, $other) = $tuple; - - $spkisExp->toXML($e); - $other?->toXML($e); + $tuple[0]->toXML($e); + $tuple[1]?->toXML($e); } return $e; diff --git a/tests/XML/ds/SPKIDataTest.php b/tests/XML/ds/SPKIDataTest.php index b07f0a74..0637897f 100644 --- a/tests/XML/ds/SPKIDataTest.php +++ b/tests/XML/ds/SPKIDataTest.php @@ -10,7 +10,7 @@ use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement; -use SimpleSAML\XMLSecurity\XML\ds\AbstractSPKIData; +use SimpleSAML\XMLSecurity\XML\ds\AbstractSPKIDataType; use SimpleSAML\XMLSecurity\XML\ds\SPKIData; use SimpleSAML\XMLSecurity\XML\ds\SPKISexp; use SimpleSAML\XMLSecurity\XML\xenc\CarriedKeyName; @@ -25,7 +25,7 @@ * @package simplesamlphp/xml-security */ #[CoversClass(AbstractDsElement::class)] -#[CoversClass(AbstractSPKIData::class)] +#[CoversClass(AbstractSPKIDataType::class)] #[CoversClass(SPKIData::class)] final class SPKIDataTest extends TestCase {