diff --git a/composer.json b/composer.json index fe7faaa..60e26b8 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "ext-pcre": "*", "simplesamlphp/assert": "~2.0", - "simplesamlphp/xml-common": "dev-feature/dom-migration-php84" + "simplesamlphp/xml-common": "~2.0" }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "~1.11" diff --git a/src/SOAP11/XML/Body.php b/src/SOAP11/XML/Body.php index 0ff3fed..924d4cc 100644 --- a/src/SOAP11/XML/Body.php +++ b/src/SOAP11/XML/Body.php @@ -16,7 +16,7 @@ use function array_diff; use function array_filter; -use function array_pop; +use function array_last; use function array_values; /** @@ -61,7 +61,7 @@ public function __construct(array $children = [], array $namespacedAttributes = })); Assert::maxCount($fault, 1, ProtocolViolationException::class); - $this->setFault(array_pop($fault)); + $this->setFault(array_last($fault)); $this->setElements(array_diff($children, $fault)); $this->setAttributesNS($namespacedAttributes); } diff --git a/src/SOAP11/XML/Envelope.php b/src/SOAP11/XML/Envelope.php index 3476918..21c847b 100644 --- a/src/SOAP11/XML/Envelope.php +++ b/src/SOAP11/XML/Envelope.php @@ -15,6 +15,8 @@ use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\XML\Constants\NS; +use function array_last; + /** * Class representing a SOAP-ENV:Envelope element. * @@ -91,8 +93,8 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($header, 1, 'Cannot process more than one Header element.', TooManyElementsException::class); return new static( - array_pop($body), - empty($header) ? null : array_pop($header), + array_last($body), + array_last($header), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); diff --git a/src/SOAP11/XML/Fault.php b/src/SOAP11/XML/Fault.php index 2e7991c..aa29690 100644 --- a/src/SOAP11/XML/Fault.php +++ b/src/SOAP11/XML/Fault.php @@ -12,6 +12,8 @@ use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use function array_last; + /** * Class representing a SOAP-ENV:Fault element. * @@ -106,10 +108,10 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($detail, 1, 'Cannot process more than one detail element.', TooManyElementsException::class); return new self( - array_pop($faultCode), - array_pop($faultString), - array_pop($faultActor), - array_pop($detail), + array_last($faultCode), + array_last($faultString), + array_last($faultActor), + array_last($detail), ); } diff --git a/src/SOAP12/XML/Body.php b/src/SOAP12/XML/Body.php index db8b2fc..701784f 100644 --- a/src/SOAP12/XML/Body.php +++ b/src/SOAP12/XML/Body.php @@ -14,7 +14,7 @@ use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Constants\NS; -use function array_pop; +use function array_last; /** * Class representing a env:Body element. @@ -104,7 +104,7 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($fault, 1, ProtocolViolationException::class); return new static( - array_pop($fault), + array_last($fault), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); diff --git a/src/SOAP12/XML/Code.php b/src/SOAP12/XML/Code.php index d0c5cc4..e8158af 100644 --- a/src/SOAP12/XML/Code.php +++ b/src/SOAP12/XML/Code.php @@ -68,8 +68,8 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($subcode, 1, 'Cannot process more than one Subcode element.', TooManyElementsException::class); return new static( - array_pop($value), - empty($subcode) ? null : array_pop($subcode), + array_last($value), + array_last($subcode), ); } diff --git a/src/SOAP12/XML/Envelope.php b/src/SOAP12/XML/Envelope.php index f057ccd..b98b3e6 100644 --- a/src/SOAP12/XML/Envelope.php +++ b/src/SOAP12/XML/Envelope.php @@ -14,6 +14,8 @@ use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\XML\Constants\NS; +use function array_last; + /** * Class representing a env:Envelope element. * @@ -83,8 +85,8 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($header, 1, 'Cannot process more than one Header element.', TooManyElementsException::class); return new static( - array_pop($body), - empty($header) ? null : array_pop($header), + array_last($body), + array_last($header), self::getAttributesNSFromXML($xml), ); } diff --git a/src/SOAP12/XML/Fault.php b/src/SOAP12/XML/Fault.php index fe44c8b..708ad7d 100644 --- a/src/SOAP12/XML/Fault.php +++ b/src/SOAP12/XML/Fault.php @@ -13,6 +13,8 @@ use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use function array_last; + /** * Class representing a env:Fault element. * @@ -116,11 +118,11 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($detail, 1, 'Cannot process more than one Detail element.', TooManyElementsException::class); return new self( - array_pop($code), - array_pop($reason), - empty($node) ? null : array_pop($node), - empty($role) ? null : array_pop($role), - empty($detail) ? null : array_pop($detail), + array_last($code), + array_last($reason), + array_last($node), + array_last($role), + array_last($detail), ); } diff --git a/src/SOAP12/XML/Subcode.php b/src/SOAP12/XML/Subcode.php index 21494bf..6696f4a 100644 --- a/src/SOAP12/XML/Subcode.php +++ b/src/SOAP12/XML/Subcode.php @@ -10,6 +10,8 @@ use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use function array_last; + /** * Class representing a env:Subcode element. * @@ -68,8 +70,8 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($subcode, 1, 'Cannot process more than one Subcode element.', TooManyElementsException::class); return new static( - array_pop($value), - empty($subcode) ? null : array_pop($subcode), + array_last($value), + array_last($subcode), ); }