From 1723d2acd3be449f02b2f001e72478526815bb84 Mon Sep 17 00:00:00 2001 From: SmetDenis Date: Sat, 27 Sep 2025 23:24:54 +0400 Subject: [PATCH] build(phpunit): Bump PHPUnit to v11 - Upgrades `phpunit/phpunit` from `^9.6.29` to `^11.5.41`. - Adjusts `CovCatcher::start` to match the updated `php-code-coverage` API, now requiring `null` for the second argument. - Adds a check in `CovCatcher::getCoverageFilter` to prevent attempting to include files from an empty directory path. --- composer.json | 2 +- src/CovCatcher.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 2e870a0..950bd30 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "ext-filter" : "*", "ext-mbstring" : "*", - "phpunit/phpunit" : "^9.6.29", + "phpunit/phpunit" : "^11.5.41", "ulrichsg/getopt-php" : ">=4.0.4", "jbzoo/markdown" : "^7.0.1" }, diff --git a/src/CovCatcher.php b/src/CovCatcher.php index 1afe093..6c8b453 100644 --- a/src/CovCatcher.php +++ b/src/CovCatcher.php @@ -122,7 +122,7 @@ private function start(): void { if (!$this->isStarted) { $this->isStarted = true; - $this->coverage?->start($this->hash, true); + $this->coverage?->start($this->hash, null, true); } } @@ -188,8 +188,10 @@ private static function prepareFilter(string $dirPath): Filter { $covFilter = new Filter(); - foreach ((new FileIteratorFacade())->getFilesAsArray($dirPath, '.php') as $file) { - $covFilter->includeFile($file); + if ($dirPath !== '') { + foreach ((new FileIteratorFacade())->getFilesAsArray($dirPath, '.php') as $file) { + $covFilter->includeFile($file); + } } return $covFilter;