Skip to content

Commit b34b908

Browse files
committed
Handle new constructor option for Text report.
A Thresolds object was introduced and must now be used when coverage extension is >= 10.0.0.
1 parent 284e5d2 commit b34b908

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/CodeCoverageExtension.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use SebastianBergmann\CodeCoverage\Driver\Selector;
2525
use SebastianBergmann\CodeCoverage\Filter;
2626
use SebastianBergmann\CodeCoverage\Report;
27+
use SebastianBergmann\CodeCoverage\Report\Thresholds;
2728
use SebastianBergmann\CodeCoverage\Version;
2829
use Symfony\Component\Console\Input\InputInterface;
2930
use Symfony\Component\Console\Input\InputOption;
@@ -119,12 +120,18 @@ public function load(ServiceContainer $container, array $params = []): void
119120

120121
break;
121122
case 'text':
122-
$reports['text'] = new Report\Text(
123-
$options['lower_upper_bound'],
124-
$options['high_lower_bound'],
125-
$options['show_uncovered_files'],
126-
$options['show_only_summary']
127-
);
123+
$reports['text'] = version_compare(Version::id(), '10.0.0', '>=') && class_exists(Thresholds::class)
124+
? new Report\Text(
125+
Thresholds::from($options['lower_upper_bound'], $options['high_lower_bound']),
126+
$options['show_uncovered_files'],
127+
$options['show_only_summary']
128+
)
129+
: new Report\Text(
130+
$options['lower_upper_bound'],
131+
$options['high_lower_bound'],
132+
$options['show_uncovered_files'],
133+
$options['show_only_summary']
134+
);
128135

129136
break;
130137
case 'xml':

0 commit comments

Comments
 (0)