diff --git a/.gitattributes b/.gitattributes index 34d242ba9..590a88ca5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,13 @@ +/.github export-ignore +/.psalm export-ignore +/tests export-ignore /tools export-ignore +/tools/* binary +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs.dist export-ignore +/.travis.yml +/build.xml +/phpunit.xml *.php diff=php diff --git a/ChangeLog.md b/ChangeLog.md index 94596db13..4d33e7133 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,17 +2,57 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [7.0.17] - 2024-03-02 + +### Changed + +* Do not use implicitly nullable parameters + +## [7.0.16] - 2024-03-01 + +* No code changes, only updated `.gitattributes` to not export non-essential files. + +## [7.0.15] - 2021-07-26 + +### Changed + +* Bumped required version of php-token-stream + +## [7.0.14] - 2020-12-02 + +### Changed + +* [#837](https://github.com/sebastianbergmann/php-code-coverage/issues/837): Allow version 4 of php-token-stream + +## [7.0.13] - 2020-11-30 + +### Changed + +* Changed PHP version constraint in `composer.json` from `^7.2` to `>=7.2` to allow installation of this version of this library on PHP 8. However, this version of this library does not work on PHP 8. PHPUnit 8.5, which uses this version of this library, does not call into this library and instead shows a message that code coverage functionality is not available for PHPUnit 8.5 on PHP 8. + +## [7.0.12] - 2020-11-27 + +### Added + +* [#834](https://github.com/sebastianbergmann/php-code-coverage/issues/834): Support `XDEBUG_MODE` environment variable + +## [7.0.11] - 2020-11-27 + +### Added + +* Support for Xdebug 3 + ## [7.0.10] - 2019-11-20 ### Fixed -* Fixed [#710](https://github.com/sebastianbergmann/php-code-coverage/pull/710): Code Coverage does not work in PhpStorm +* [#710](https://github.com/sebastianbergmann/php-code-coverage/pull/710): Code Coverage does not work in PhpStorm ## [7.0.9] - 2019-11-20 ### Changed -* Implemented [#709](https://github.com/sebastianbergmann/php-code-coverage/pull/709): Prioritize PCOV over Xdebug +* [#709](https://github.com/sebastianbergmann/php-code-coverage/pull/709): Prioritize PCOV over Xdebug ## [7.0.8] - 2019-09-17 @@ -36,19 +76,19 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed -* Fixed [#681](https://github.com/sebastianbergmann/php-code-coverage/pull/681): `use function` statements are not ignored +* [#681](https://github.com/sebastianbergmann/php-code-coverage/pull/681): `use function` statements are not ignored ## [7.0.4] - 2019-05-29 ### Fixed -* Fixed [#682](https://github.com/sebastianbergmann/php-code-coverage/pull/682): Code that is not executed is reported as being executed when using PCOV +* [#682](https://github.com/sebastianbergmann/php-code-coverage/pull/682): Code that is not executed is reported as being executed when using PCOV ## [7.0.3] - 2019-02-26 ### Fixed -* Fixed [#671](https://github.com/sebastianbergmann/php-code-coverage/issues/671): `TypeError` when directory name is a number +* [#671](https://github.com/sebastianbergmann/php-code-coverage/issues/671): `TypeError` when directory name is a number ## [7.0.2] - 2019-02-15 @@ -58,13 +98,13 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed -* Fixed [#667](https://github.com/sebastianbergmann/php-code-coverage/pull/667): `TypeError` in PHP reporter +* [#667](https://github.com/sebastianbergmann/php-code-coverage/pull/667): `TypeError` in PHP reporter ## [7.0.1] - 2019-02-01 ### Fixed -* Fixed [#664](https://github.com/sebastianbergmann/php-code-coverage/issues/664): `TypeError` when whitelisted file does not exist +* [#664](https://github.com/sebastianbergmann/php-code-coverage/issues/664): `TypeError` when whitelisted file does not exist ## [7.0.0] - 2019-02-01 @@ -74,8 +114,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed -* Fixed [#654](https://github.com/sebastianbergmann/php-code-coverage/issues/654): HTML report fails to load assets -* Fixed [#655](https://github.com/sebastianbergmann/php-code-coverage/issues/655): Popin pops in outside of screen +* [#654](https://github.com/sebastianbergmann/php-code-coverage/issues/654): HTML report fails to load assets +* [#655](https://github.com/sebastianbergmann/php-code-coverage/issues/655): Popin pops in outside of screen ### Removed @@ -85,7 +125,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed -* Fixed [#650](https://github.com/sebastianbergmann/php-code-coverage/issues/650): Wasted screen space in HTML code coverage report +* [#650](https://github.com/sebastianbergmann/php-code-coverage/issues/650): Wasted screen space in HTML code coverage report ## [6.1.3] - 2018-10-23 @@ -97,7 +137,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed -* Fixed [#645](https://github.com/sebastianbergmann/php-code-coverage/pull/645): Crash that can occur when php-token-stream parses invalid files +* [#645](https://github.com/sebastianbergmann/php-code-coverage/pull/645): Crash that can occur when php-token-stream parses invalid files ## [6.1.1] - 2018-10-18 @@ -112,6 +152,13 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt * Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report * Update HTML report to Bootstrap 4 +[7.0.17]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.16...7.0.17 +[7.0.16]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.15...7.0.16 +[7.0.15]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.14...7.0.15 +[7.0.14]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.13...7.0.14 +[7.0.13]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.12...7.0.13 +[7.0.12]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.11...7.0.12 +[7.0.11]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.10...7.0.11 [7.0.10]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.9...7.0.10 [7.0.9]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.8...7.0.9 [7.0.8]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.7...7.0.8 diff --git a/composer.json b/composer.json index 19f8586a5..ed6e8132b 100644 --- a/composer.json +++ b/composer.json @@ -25,11 +25,11 @@ }, "prefer-stable": true, "require": { - "php": "^7.2", + "php": ">=7.2", "ext-dom": "*", "ext-xmlwriter": "*", "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-token-stream": "^3.1.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "phpunit/php-text-template": "^1.2.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^4.2.2", diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php index ced3b75df..9cdef18b9 100644 --- a/src/CodeCoverage.php +++ b/src/CodeCoverage.php @@ -137,7 +137,7 @@ final class CodeCoverage /** * @throws RuntimeException */ - public function __construct(Driver $driver = null, Filter $filter = null) + public function __construct(?Driver $driver = null, ?Filter $filter = null) { if ($filter === null) { $filter = new Filter; diff --git a/src/Driver/Xdebug.php b/src/Driver/Xdebug.php index 737949636..36133055f 100644 --- a/src/Driver/Xdebug.php +++ b/src/Driver/Xdebug.php @@ -32,14 +32,25 @@ final class Xdebug implements Driver /** * @throws RuntimeException */ - public function __construct(Filter $filter = null) + public function __construct(?Filter $filter = null) { if (!\extension_loaded('xdebug')) { throw new RuntimeException('This driver requires Xdebug'); } - if (!\ini_get('xdebug.coverage_enable')) { - throw new RuntimeException('xdebug.coverage_enable=On has to be set in php.ini'); + if (\version_compare(\phpversion('xdebug'), '3', '>=')) { + $mode = \getenv('XDEBUG_MODE'); + + if ($mode === false) { + $mode = \ini_get('xdebug.mode'); + } + + if ($mode === false || + !\in_array('coverage', \explode(',', $mode), true)) { + throw new RuntimeException('XDEBUG_MODE=coverage (environment variable) or xdebug.mode=coverage (PHP configuration setting) has to be set'); + } + } elseif (!\ini_get('xdebug.coverage_enable')) { + throw new RuntimeException('xdebug.coverage_enable=On (PHP configuration setting) has to be set'); } if ($filter === null) { diff --git a/src/Node/AbstractNode.php b/src/Node/AbstractNode.php index 116a09f17..3dcbee299 100644 --- a/src/Node/AbstractNode.php +++ b/src/Node/AbstractNode.php @@ -41,7 +41,7 @@ abstract class AbstractNode implements \Countable */ private $id; - public function __construct(string $name, self $parent = null) + public function __construct(string $name, ?self $parent = null) { if (\substr($name, -1) == \DIRECTORY_SEPARATOR) { $name = \substr($name, 0, -1); diff --git a/src/Version.php b/src/Version.php index bcf232d25..93e933c21 100644 --- a/src/Version.php +++ b/src/Version.php @@ -21,7 +21,7 @@ final class Version public static function id(): string { if (self::$version === null) { - $version = new VersionId('7.0.10', \dirname(__DIR__)); + $version = new VersionId('7.0.17', \dirname(__DIR__)); self::$version = $version->getVersion(); } diff --git a/tools/composer b/tools/composer index b8ce13f23..e6ba7bbad 100755 Binary files a/tools/composer and b/tools/composer differ