From 993cb7e3cf3563150c780f13b7637d96237c7306 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Fri, 6 Dec 2024 00:24:03 +0100
Subject: [PATCH] Exclude empty parameters

---
 src/XML/xenc11/AbstractAlgorithmIdentifierType.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/XML/xenc11/AbstractAlgorithmIdentifierType.php b/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
index edebbbfd..9b794ad5 100644
--- a/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
+++ b/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
@@ -59,7 +59,11 @@ public function toXML(?DOMElement $parent = null): DOMElement
         $e = $this->instantiateParentElement($parent);
         $e->setAttribute('Algorithm', $this->getAlgorithm());
 
-        $this->getParameters()?->toXML($e);
+        if ($this->getParameters() !== null) {
+            if (!$this->getParameters()->isEmptyElement()) {
+                $this->getParameters()?->toXML($e);
+            }
+        }
 
         return $e;
     }