Skip to content

Commit

Permalink
Removed deprecated method (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Apr 13, 2023
1 parent 896d98c commit 14fffbc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .phan.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'vendor/jbzoo/markdown',

'vendor/phpunit/php-code-coverage/src',
'vendor/phpunit/php-file-iterator/src',
'vendor/phpunit/phpunit/src',
'vendor/symfony/finder',
'vendor/ulrichsg/getopt-php/src',
Expand Down
17 changes: 14 additions & 3 deletions src/CovCatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use SebastianBergmann\CodeCoverage\Report\Clover;
use SebastianBergmann\CodeCoverage\Report\Html\Facade;
use SebastianBergmann\CodeCoverage\Report\PHP;
use SebastianBergmann\FileIterator\Facade as FileIteratorFacade;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand Down Expand Up @@ -73,10 +74,9 @@ public function __construct(string $testName = '', array $options = [])

$this->coverage = null;
if (Sys::hasXdebug()) {
$covFilter = new Filter();
$covFilter->includeDirectory($this->config->getString('src'));
$covFilter = self::prepareFilter($this->config->getString('src'));
$driver = (new Selector())->forLineAndPathCoverage($covFilter);

$driver = (new Selector())->forLineAndPathCoverage($covFilter);
$this->coverage = new CodeCoverage($driver, $covFilter);
}
}
Expand Down Expand Up @@ -184,6 +184,17 @@ protected function initConfig(array $options): void
$this->config = new Data(\array_merge($this->default, $options));
}

protected static function prepareFilter(string $dirPath): Filter
{
$covFilter = new Filter();

foreach ((new FileIteratorFacade())->getFilesAsArray($dirPath, '.php') as $file) {
$covFilter->includeFile($file);
}

return $covFilter;
}

protected static function prepareDirectory(string $dirPath): void
{
/** @phan-suppress-next-line PhanPluginDuplicateIfCondition */
Expand Down

0 comments on commit 14fffbc

Please sign in to comment.