Skip to content

Commit d36811a

Browse files
theseersebastianbergmann
authored andcommitted
Use Snapshot list helper to avoid possible incomplete migrations
1 parent bf2f30c commit d36811a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use DOMDocument;
1313
use DOMElement;
14+
use TextUI\XmlConfiguration\Migration\SnapshotNodeList;
1415

1516
/**
1617
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -37,7 +38,7 @@ public function migrate(DOMDocument $document): void
3738
$include = $document->createElement('include');
3839
$coverage->appendChild($include);
3940

40-
foreach ($whitelist->childNodes as $child) {
41+
foreach (SnapshotNodeList::fromNodeList($whitelist->childNodes) as $child) {
4142
if (!$child instanceof DOMElement || $child->nodeName !== 'directory') {
4243
continue;
4344
}

src/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use DOMDocument;
1313
use DOMElement;
14+
use TextUI\XmlConfiguration\Migration\SnapshotNodeList;
1415

1516
/**
1617
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -25,7 +26,7 @@ public function migrate(DOMDocument $document): void
2526
return;
2627
}
2728

28-
foreach ($logging->getElementsByTagName('log') as $logNode) {
29+
foreach (SnapshotNodeList::fromNodeList($logging->getElementsByTagName('log')) as $logNode) {
2930
switch ($logNode->getAttribute('type')) {
3031
case 'json':
3132
case 'tap':

0 commit comments

Comments
 (0)