@@ -33,14 +33,11 @@ public function loadMessageXml(string $message_xml_file)
3333 }
3434
3535 $ messageXml = new \SimpleXMLIterator ($ messageXmlString );
36- unset( $ messageXmlString );
37- $ message = [
36+
37+ return [
3838 'defaults ' => $ this ->readMessageDefaults ($ messageXml ),
3939 'segments ' => $ this ->readXmlNodes ($ messageXml ),
4040 ];
41- unset($ messageXml );
42-
43- return $ message ;
4441 }
4542
4643 /**
@@ -58,7 +55,6 @@ public function loadCodesXml(string $codesXml)
5855 }
5956
6057 $ codesXml = new \SimpleXMLIterator ($ codesXmlString );
61- unset($ codesXmlString );
6258 $ codes = [];
6359 foreach ($ codesXml as $ codeCollection ) {
6460 \assert ($ codeCollection instanceof \SimpleXMLIterator);
@@ -111,12 +107,14 @@ public function loadSegmentsXml(string $segment_xml_file)
111107 $ segments_xml = null ;
112108
113109 foreach ($ xml as $ segmentNode ) {
110+ \assert ($ segmentNode instanceof \SimpleXMLElement);
114111
115- /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */
116- /* @var \SimpleXMLElement $segmentNode */
117- $ segmentNode = $ segmentNode ;
112+ $ segmentNodeAttributes = $ segmentNode ->attributes ();
113+ if ($ segmentNodeAttributes === null ) {
114+ continue ;
115+ }
118116
119- $ qualifier = (string ) $ segmentNode -> attributes () ->id ;
117+ $ qualifier = (string ) $ segmentNodeAttributes ->id ;
120118 $ segment = [];
121119 $ segment ['attributes ' ] = $ this ->readAttributesArray ($ segmentNode );
122120 $ details = $ this ->readXmlNodes ($ segmentNode );
@@ -193,7 +191,7 @@ public function process(array $data, array $rawSegments = null): string
193191 $ r [] = ' length: ' . $ d_sub_desc_attr ['length ' ];
194192 }
195193
196- //check for skipped data
194+ // check for skipped data
197195 unset(
198196 $ d_sub_desc_attr ['id ' ],
199197 $ d_sub_desc_attr ['name ' ],
0 commit comments