@@ -127,7 +127,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string
127127 $ xmlMetrics ->setAttribute ('coveredstatements ' , (string ) $ coveredClassStatements );
128128 $ xmlMetrics ->setAttribute ('elements ' , (string ) ($ classMethods + $ classStatements + $ class ['executableBranches ' ]));
129129 $ xmlMetrics ->setAttribute ('coveredelements ' , (string ) ($ coveredMethods + $ coveredClassStatements + $ class ['executedBranches ' ]));
130- $ xmlClass ->appendChild ($ xmlMetrics );
130+ $ xmlClass ->insertBefore ($ xmlMetrics, $ xmlClass -> firstChild );
131131 }
132132
133133 foreach ($ coverageData as $ line => $ data ) {
@@ -181,7 +181,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string
181181 $ xmlMetrics ->setAttribute ('coveredstatements ' , (string ) $ item ->numberOfExecutedLines ());
182182 $ xmlMetrics ->setAttribute ('elements ' , (string ) ($ item ->numberOfMethods () + $ item ->numberOfExecutableLines () + $ item ->numberOfExecutableBranches ()));
183183 $ xmlMetrics ->setAttribute ('coveredelements ' , (string ) ($ item ->numberOfTestedMethods () + $ item ->numberOfExecutedLines () + $ item ->numberOfExecutedBranches ()));
184- $ xmlFile ->appendChild ($ xmlMetrics );
184+ $ xmlFile ->insertBefore ($ xmlMetrics, $ xmlFile -> firstChild );
185185
186186 if ($ namespace === 'global ' ) {
187187 $ xmlProject ->appendChild ($ xmlFile );
@@ -214,7 +214,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string
214214 $ xmlMetrics ->setAttribute ('coveredstatements ' , (string ) $ report ->numberOfExecutedLines ());
215215 $ xmlMetrics ->setAttribute ('elements ' , (string ) ($ report ->numberOfMethods () + $ report ->numberOfExecutableLines () + $ report ->numberOfExecutableBranches ()));
216216 $ xmlMetrics ->setAttribute ('coveredelements ' , (string ) ($ report ->numberOfTestedMethods () + $ report ->numberOfExecutedLines () + $ report ->numberOfExecutedBranches ()));
217- $ xmlProject ->appendChild ($ xmlMetrics );
217+ $ xmlProject ->insertBefore ($ xmlMetrics, $ xmlProject -> firstChild );
218218
219219 $ buffer = $ xmlDocument ->saveXML ();
220220
0 commit comments