55namespace AtomGenerator ;
66
77use DOMDocument ;
8- use Exception ;
98use LibXMLError ;
109use SimpleXMLElement ;
1110use Webmozart \Assert \Assert ;
@@ -153,6 +152,7 @@ public function addChildrenTo(SimpleXMLElement $parent): void
153152
154153 if (null !== $ this ->generator ) {
155154 $ generator = $ parent ->addChild ('generator ' , htmlspecialchars ($ this ->generator ));
155+ assert (null !== $ generator );
156156 if (null !== $ this ->generatorVersion ) {
157157 $ generator ->addAttribute ('version ' , $ this ->generatorVersion );
158158 }
@@ -163,6 +163,7 @@ public function addChildrenTo(SimpleXMLElement $parent): void
163163
164164 foreach ($ this ->customElements as $ customElement ) {
165165 $ element = $ parent ->addChild ($ customElement ['name ' ], htmlspecialchars ($ customElement ['value ' ]), $ customElement ['uri ' ]);
166+ assert (null !== $ element );
166167 foreach ($ customElement ['attributes ' ] as $ name => $ value ) {
167168 $ element ->addAttribute ($ name , $ value );
168169 }
@@ -173,9 +174,6 @@ public function addChildrenTo(SimpleXMLElement $parent): void
173174 }
174175 }
175176
176- /**
177- * @throws Exception
178- */
179177 public function getSimpleXML (): SimpleXMLElement
180178 {
181179 $ attributes = [];
@@ -198,9 +196,6 @@ public function getSimpleXML(): SimpleXMLElement
198196 return $ xml ;
199197 }
200198
201- /**
202- * @throws Exception
203- */
204199 public function getDocument (): DOMDocument
205200 {
206201 $ node = dom_import_simplexml ($ this ->getSimpleXML ());
@@ -212,8 +207,6 @@ public function getDocument(): DOMDocument
212207
213208 /**
214209 * @return false|string
215- *
216- * @throws Exception
217210 */
218211 public function saveXML ()
219212 {
0 commit comments