From 2f478b2308b06c10542488ce9690a98baaf2fdfa Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 2 Dec 2024 00:21:20 +0100 Subject: [PATCH] Explicit nullable type --- src/Utils/XML.php | 4 ++-- src/XML/EncryptedElementTrait.php | 4 ++-- src/XML/SignedElementInterface.php | 2 +- src/XML/SignedElementTrait.php | 2 +- src/XML/ds/AbstractKeyInfoType.php | 2 +- src/XML/ds/CanonicalizationMethod.php | 2 +- src/XML/ds/DigestMethod.php | 2 +- src/XML/ds/DsObject.php | 2 +- src/XML/ds/KeyValue.php | 2 +- src/XML/ds/Manifest.php | 2 +- src/XML/ds/RSAKeyValue.php | 2 +- src/XML/ds/Reference.php | 2 +- src/XML/ds/RetrievalMethod.php | 2 +- src/XML/ds/Signature.php | 2 +- src/XML/ds/SignatureMethod.php | 2 +- src/XML/ds/SignatureProperties.php | 2 +- src/XML/ds/SignatureProperty.php | 2 +- src/XML/ds/SignatureValue.php | 2 +- src/XML/ds/SignedInfo.php | 2 +- src/XML/ds/Transform.php | 2 +- src/XML/ds/Transforms.php | 2 +- src/XML/ds/X509Data.php | 2 +- src/XML/ds/X509IssuerSerial.php | 2 +- src/XML/ds/X509SerialNumber.php | 2 +- src/XML/ds/XPath.php | 2 +- src/XML/dsig11/KeyInfoReference.php | 2 +- src/XML/dsig11/X509Digest.php | 2 +- src/XML/ec/InclusiveNamespaces.php | 2 +- src/XML/xenc/AbstractAgreementMethodType.php | 2 +- src/XML/xenc/AbstractDHKeyValueType.php | 2 +- src/XML/xenc/AbstractEncryptedType.php | 2 +- src/XML/xenc/AbstractEncryptionMethod.php | 2 +- src/XML/xenc/AbstractEncryptionPropertiesType.php | 2 +- src/XML/xenc/AbstractEncryptionPropertyType.php | 2 +- src/XML/xenc/AbstractReference.php | 2 +- src/XML/xenc/CipherData.php | 2 +- src/XML/xenc/CipherReference.php | 2 +- src/XML/xenc/EncryptedKey.php | 2 +- src/XML/xenc/KeySize.php | 2 +- src/XML/xenc/ReferenceList.php | 2 +- src/XML/xenc/Transforms.php | 2 +- tests/XML/CustomSignable.php | 2 +- 42 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/Utils/XML.php b/src/Utils/XML.php index e17fe16d..f2dafca5 100644 --- a/src/Utils/XML.php +++ b/src/Utils/XML.php @@ -33,8 +33,8 @@ class XML public static function canonicalizeData( DOMElement $element, string $c14nMethod, - array $xpaths = null, - array $prefixes = null, + ?array $xpaths = null, + ?array $prefixes = null, ): string { $withComments = match ($c14nMethod) { C::C14N_EXCLUSIVE_WITH_COMMENTS, C::C14N_INCLUSIVE_WITH_COMMENTS => true, diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 5c8c9548..48b381f8 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -179,7 +179,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $this->encryptedData->toXML($e); @@ -196,7 +196,7 @@ public function toXML(DOMElement $parent = null): DOMElement * @param \DOMElement|null $parent The element we should append to. * @return \DOMElement */ - abstract public function instantiateParentElement(DOMElement $parent = null): DOMElement; + abstract public function instantiateParentElement(?DOMElement $parent = null): DOMElement; /** diff --git a/src/XML/SignedElementInterface.php b/src/XML/SignedElementInterface.php index cf2e3c9a..d48ef0c3 100644 --- a/src/XML/SignedElementInterface.php +++ b/src/XML/SignedElementInterface.php @@ -65,5 +65,5 @@ public function isSigned(): bool; * in the signature. * @throws \SimpleSAML\XMLSecurity\Exception\RuntimeException if the signature fails to validate. */ - public function verify(SignatureAlgorithmInterface $verifier = null): SignedElementInterface; + public function verify(?SignatureAlgorithmInterface $verifier = null): SignedElementInterface; } diff --git a/src/XML/SignedElementTrait.php b/src/XML/SignedElementTrait.php index 10b7ccbe..8fa73658 100644 --- a/src/XML/SignedElementTrait.php +++ b/src/XML/SignedElementTrait.php @@ -251,7 +251,7 @@ public function isSigned(): bool * in the signature. * @throws \SimpleSAML\XMLSecurity\Exception\RuntimeException if the signature fails to verify. */ - public function verify(SignatureAlgorithmInterface $verifier = null): SignedElementInterface + public function verify(?SignatureAlgorithmInterface $verifier = null): SignedElementInterface { if (!$this->isSigned()) { throw new NoSignatureFoundException(); diff --git a/src/XML/ds/AbstractKeyInfoType.php b/src/XML/ds/AbstractKeyInfoType.php index b266045f..2de04d67 100644 --- a/src/XML/ds/AbstractKeyInfoType.php +++ b/src/XML/ds/AbstractKeyInfoType.php @@ -100,7 +100,7 @@ public function getInfo(): array * @param \DOMElement|null $parent The element we should append this KeyInfo to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/CanonicalizationMethod.php b/src/XML/ds/CanonicalizationMethod.php index f7844a3f..ddb319f5 100644 --- a/src/XML/ds/CanonicalizationMethod.php +++ b/src/XML/ds/CanonicalizationMethod.php @@ -78,7 +78,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this KeyName element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()); diff --git a/src/XML/ds/DigestMethod.php b/src/XML/ds/DigestMethod.php index 9ce95f54..335d5d4e 100644 --- a/src/XML/ds/DigestMethod.php +++ b/src/XML/ds/DigestMethod.php @@ -84,7 +84,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this DigestMethod element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()); diff --git a/src/XML/ds/DsObject.php b/src/XML/ds/DsObject.php index 72f78f5a..00f0fae0 100644 --- a/src/XML/ds/DsObject.php +++ b/src/XML/ds/DsObject.php @@ -123,7 +123,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this ds:Object element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/KeyValue.php b/src/XML/ds/KeyValue.php index b6f2d018..7677371b 100644 --- a/src/XML/ds/KeyValue.php +++ b/src/XML/ds/KeyValue.php @@ -100,7 +100,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this KeyValue element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/Manifest.php b/src/XML/ds/Manifest.php index b78c53cd..9eac89ab 100644 --- a/src/XML/ds/Manifest.php +++ b/src/XML/ds/Manifest.php @@ -88,7 +88,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Manifest element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/RSAKeyValue.php b/src/XML/ds/RSAKeyValue.php index 1a23e70b..ff56e935 100644 --- a/src/XML/ds/RSAKeyValue.php +++ b/src/XML/ds/RSAKeyValue.php @@ -104,7 +104,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this RSAKeyValue element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/Reference.php b/src/XML/ds/Reference.php index fc7e2e83..86baeab8 100644 --- a/src/XML/ds/Reference.php +++ b/src/XML/ds/Reference.php @@ -167,7 +167,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Reference element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); if ($this->getId() !== null) { diff --git a/src/XML/ds/RetrievalMethod.php b/src/XML/ds/RetrievalMethod.php index e75fcca8..e14b15c4 100644 --- a/src/XML/ds/RetrievalMethod.php +++ b/src/XML/ds/RetrievalMethod.php @@ -100,7 +100,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this RetrievalMethod element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getURI()); diff --git a/src/XML/ds/Signature.php b/src/XML/ds/Signature.php index d004a314..93658706 100644 --- a/src/XML/ds/Signature.php +++ b/src/XML/ds/Signature.php @@ -161,7 +161,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Signature element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/SignatureMethod.php b/src/XML/ds/SignatureMethod.php index 095e1ecb..df2470e3 100644 --- a/src/XML/ds/SignatureMethod.php +++ b/src/XML/ds/SignatureMethod.php @@ -76,7 +76,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this SignatureMethod element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()); diff --git a/src/XML/ds/SignatureProperties.php b/src/XML/ds/SignatureProperties.php index cd5ff196..cb8cbe10 100644 --- a/src/XML/ds/SignatureProperties.php +++ b/src/XML/ds/SignatureProperties.php @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this SignatureProperties element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/SignatureProperty.php b/src/XML/ds/SignatureProperty.php index c8b312c6..858b16f4 100644 --- a/src/XML/ds/SignatureProperty.php +++ b/src/XML/ds/SignatureProperty.php @@ -102,7 +102,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this SignatureProperty element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Target', $this->getTarget()); diff --git a/src/XML/ds/SignatureValue.php b/src/XML/ds/SignatureValue.php index d023cf4e..d90f3c7d 100644 --- a/src/XML/ds/SignatureValue.php +++ b/src/XML/ds/SignatureValue.php @@ -70,7 +70,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this SignatureValue element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getContent(); diff --git a/src/XML/ds/SignedInfo.php b/src/XML/ds/SignedInfo.php index 0779cc42..4c83d61d 100644 --- a/src/XML/ds/SignedInfo.php +++ b/src/XML/ds/SignedInfo.php @@ -172,7 +172,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this SignedInfo element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/Transform.php b/src/XML/ds/Transform.php index 867b4891..b18abb31 100644 --- a/src/XML/ds/Transform.php +++ b/src/XML/ds/Transform.php @@ -127,7 +127,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Transform element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/Transforms.php b/src/XML/ds/Transforms.php index db46c4fe..aef93203 100644 --- a/src/XML/ds/Transforms.php +++ b/src/XML/ds/Transforms.php @@ -76,7 +76,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Transforms element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/X509Data.php b/src/XML/ds/X509Data.php index b9c68947..d810143d 100644 --- a/src/XML/ds/X509Data.php +++ b/src/XML/ds/X509Data.php @@ -98,7 +98,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this X509Data element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/X509IssuerSerial.php b/src/XML/ds/X509IssuerSerial.php index 483d1906..dc0a70da 100644 --- a/src/XML/ds/X509IssuerSerial.php +++ b/src/XML/ds/X509IssuerSerial.php @@ -90,7 +90,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this X509IssuerSerial element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/ds/X509SerialNumber.php b/src/XML/ds/X509SerialNumber.php index d7b65913..a24f19c9 100644 --- a/src/XML/ds/X509SerialNumber.php +++ b/src/XML/ds/X509SerialNumber.php @@ -66,7 +66,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this X509SerialNumber element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getContent(); diff --git a/src/XML/ds/XPath.php b/src/XML/ds/XPath.php index cf84778d..087c8b17 100644 --- a/src/XML/ds/XPath.php +++ b/src/XML/ds/XPath.php @@ -88,7 +88,7 @@ public static function fromXML(DOMElement $xml): static * @param DOMElement|null $parent * @return DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getExpression(); diff --git a/src/XML/dsig11/KeyInfoReference.php b/src/XML/dsig11/KeyInfoReference.php index e1bdc5f6..b9a6a78e 100644 --- a/src/XML/dsig11/KeyInfoReference.php +++ b/src/XML/dsig11/KeyInfoReference.php @@ -80,7 +80,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this KeyInfoReference element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getURI()); diff --git a/src/XML/dsig11/X509Digest.php b/src/XML/dsig11/X509Digest.php index 277dee82..0eda198a 100644 --- a/src/XML/dsig11/X509Digest.php +++ b/src/XML/dsig11/X509Digest.php @@ -81,7 +81,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this X509Digest element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->textContent = $this->getContent(); diff --git a/src/XML/ec/InclusiveNamespaces.php b/src/XML/ec/InclusiveNamespaces.php index 7deff9eb..eb79c964 100644 --- a/src/XML/ec/InclusiveNamespaces.php +++ b/src/XML/ec/InclusiveNamespaces.php @@ -68,7 +68,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this InclusiveNamespaces to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/AbstractAgreementMethodType.php b/src/XML/xenc/AbstractAgreementMethodType.php index 009887d0..978dbb62 100644 --- a/src/XML/xenc/AbstractAgreementMethodType.php +++ b/src/XML/xenc/AbstractAgreementMethodType.php @@ -140,7 +140,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this AgreementMethod to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()); diff --git a/src/XML/xenc/AbstractDHKeyValueType.php b/src/XML/xenc/AbstractDHKeyValueType.php index 66b60d81..ff1afde2 100644 --- a/src/XML/xenc/AbstractDHKeyValueType.php +++ b/src/XML/xenc/AbstractDHKeyValueType.php @@ -172,7 +172,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this DHKeyValue to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/AbstractEncryptedType.php b/src/XML/xenc/AbstractEncryptedType.php index 6a3e7c96..ad005c03 100644 --- a/src/XML/xenc/AbstractEncryptedType.php +++ b/src/XML/xenc/AbstractEncryptedType.php @@ -125,7 +125,7 @@ public function getType(): ?string /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/AbstractEncryptionMethod.php b/src/XML/xenc/AbstractEncryptionMethod.php index bafc54fa..0b386162 100644 --- a/src/XML/xenc/AbstractEncryptionMethod.php +++ b/src/XML/xenc/AbstractEncryptionMethod.php @@ -118,7 +118,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this EncryptionMethod to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('Algorithm', $this->getAlgorithm()); diff --git a/src/XML/xenc/AbstractEncryptionPropertiesType.php b/src/XML/xenc/AbstractEncryptionPropertiesType.php index 63c79f3c..5b9810b8 100644 --- a/src/XML/xenc/AbstractEncryptionPropertiesType.php +++ b/src/XML/xenc/AbstractEncryptionPropertiesType.php @@ -75,7 +75,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/AbstractEncryptionPropertyType.php b/src/XML/xenc/AbstractEncryptionPropertyType.php index 9a56bc77..a70ff237 100644 --- a/src/XML/xenc/AbstractEncryptionPropertyType.php +++ b/src/XML/xenc/AbstractEncryptionPropertyType.php @@ -99,7 +99,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/AbstractReference.php b/src/XML/xenc/AbstractReference.php index f67f6e1d..225fdbf1 100644 --- a/src/XML/xenc/AbstractReference.php +++ b/src/XML/xenc/AbstractReference.php @@ -74,7 +74,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getUri()); diff --git a/src/XML/xenc/CipherData.php b/src/XML/xenc/CipherData.php index 39ddc20a..3da5ac6e 100644 --- a/src/XML/xenc/CipherData.php +++ b/src/XML/xenc/CipherData.php @@ -100,7 +100,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/CipherReference.php b/src/XML/xenc/CipherReference.php index e2a169f3..592ee0cf 100644 --- a/src/XML/xenc/CipherReference.php +++ b/src/XML/xenc/CipherReference.php @@ -68,7 +68,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->setAttribute('URI', $this->getUri()); diff --git a/src/XML/xenc/EncryptedKey.php b/src/XML/xenc/EncryptedKey.php index 76754a4e..0dcf0603 100644 --- a/src/XML/xenc/EncryptedKey.php +++ b/src/XML/xenc/EncryptedKey.php @@ -242,7 +242,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::toXML($parent); diff --git a/src/XML/xenc/KeySize.php b/src/XML/xenc/KeySize.php index c2faef38..c0864922 100644 --- a/src/XML/xenc/KeySize.php +++ b/src/XML/xenc/KeySize.php @@ -60,7 +60,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $e->textContent = strval($this->getKeySize()); diff --git a/src/XML/xenc/ReferenceList.php b/src/XML/xenc/ReferenceList.php index 1791b75d..537768e8 100644 --- a/src/XML/xenc/ReferenceList.php +++ b/src/XML/xenc/ReferenceList.php @@ -98,7 +98,7 @@ public static function fromXML(DOMElement $xml): static /** * @inheritDoc */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/src/XML/xenc/Transforms.php b/src/XML/xenc/Transforms.php index 02f20449..078f252c 100644 --- a/src/XML/xenc/Transforms.php +++ b/src/XML/xenc/Transforms.php @@ -77,7 +77,7 @@ public static function fromXML(DOMElement $xml): static * @param \DOMElement|null $parent The element we should append this Transforms element to. * @return \DOMElement */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); diff --git a/tests/XML/CustomSignable.php b/tests/XML/CustomSignable.php index 91dad755..39632086 100644 --- a/tests/XML/CustomSignable.php +++ b/tests/XML/CustomSignable.php @@ -182,7 +182,7 @@ public static function fromXML(DOMElement $xml): static * @return \DOMElement The XML element after adding the data corresponding to this CustomSignable. * @throws \Exception */ - public function toXML(DOMElement $parent = null): DOMElement + public function toXML(?DOMElement $parent = null): DOMElement { if ($this->signer !== null) { $signedXML = $this->doSign($this->xml);