Skip to content

Commit 18bb622

Browse files
author
dmajka
committed
Blacklist: Fix building of the excludes list
Reason: The "+" operator compares keys from two arrays, which, while building the excludes list, results in some paths being skipped. Implementation: Replaced array union operator with simple array_merge. Unfortunately, this approach might generate duplicate paths, so an array_unique call was added. Side effects: None.
1 parent 944f7d0 commit 18bb622

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Listener/CodeCoverageListener.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,19 @@ public function beforeSuite(SuiteEvent $event): void
154154
foreach ($this->options['blacklist'] as $option) {
155155
$settings = $this->filterDirectoryParams($option);
156156
if (!empty($settings['suffix']) || !empty($settings['prefix'])) {
157-
$excludes = $excludes + (new FileIteratorFacade())->getFilesAsArray(
158-
$settings['directory'],
159-
$settings['suffix'],
160-
$settings['prefix']
157+
$excludes = array_merge(
158+
$excludes,
159+
(new FileIteratorFacade())->getFilesAsArray(
160+
$settings['directory'],
161+
$settings['suffix'],
162+
$settings['prefix']
163+
)
161164
);
162165
} else {
163166
$excludes[] = $settings['directory'];
164167
}
165168
}
169+
$excludes = array_unique($excludes);
166170

167171
foreach ($this->options['whitelist'] as $option) {
168172
$settings = $this->filterDirectoryParams($option);

0 commit comments

Comments
 (0)