From 5390f63f3275266d753ff6da10ecc9829ca77ac4 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 10:57:00 +0900 Subject: [PATCH 01/38] Set XDEBUG_MODE for processes with coverage Fixes #1473 --- src/Process/CoveredPhpProcess.php | 64 +++++++++++++++++++ .../Factory/InitialTestsRunProcessFactory.php | 3 +- .../InitialTestsRunProcessFactoryTest.php | 2 + 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/Process/CoveredPhpProcess.php diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php new file mode 100644 index 000000000..51cc010fd --- /dev/null +++ b/src/Process/CoveredPhpProcess.php @@ -0,0 +1,64 @@ +|null $env + */ + public function start(?callable $callback = null, ?array $env = null): void + { + $env = array_merge($env ?? [], [ + 'XDEBUG_MODE' => 'debug', + ]); + + parent::start($callback, $env); + } +} diff --git a/src/Process/Factory/InitialTestsRunProcessFactory.php b/src/Process/Factory/InitialTestsRunProcessFactory.php index 934022471..d8588bc05 100644 --- a/src/Process/Factory/InitialTestsRunProcessFactory.php +++ b/src/Process/Factory/InitialTestsRunProcessFactory.php @@ -36,6 +36,7 @@ namespace Infection\Process\Factory; use Infection\AbstractTestFramework\TestFrameworkAdapter; +use Infection\Process\CoveredPhpProcess; use Infection\Process\OriginalPhpProcess; use function method_exists; use Symfony\Component\Process\Process; @@ -64,7 +65,7 @@ public function createProcess( bool $skipCoverage ): Process { // If we're expecting to receive a code coverage, test process must run in a vanilla environment - $processClass = $skipCoverage ? Process::class : OriginalPhpProcess::class; + $processClass = $skipCoverage ? CoveredPhpProcess::class : OriginalPhpProcess::class; /** @var Process $process */ $process = new $processClass( diff --git a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php index 87ca5433a..5ec773fa5 100644 --- a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php +++ b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php @@ -36,6 +36,7 @@ namespace Infection\Tests\Process\Factory; use Infection\AbstractTestFramework\TestFrameworkAdapter; +use Infection\Process\CoveredPhpProcess; use Infection\Process\Factory\InitialTestsRunProcessFactory; use Infection\Process\OriginalPhpProcess; use const PHP_OS_FAMILY; @@ -86,6 +87,7 @@ public function test_it_creates_a_process_with_coverage_skipped(): void $this->assertNull($process->getTimeout()); $this->assertNotInstanceOf(OriginalPhpProcess::class, $process); + $this->assertInstanceOf(CoveredPhpProcess::class, $process); } public function test_it_creates_a_process_with_coverage(): void From 317e5ceb1f4952577c00bc987adaa720a509f4bb Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 11:00:01 +0900 Subject: [PATCH 02/38] Don't even mention XDEBUG_MODE --- src/TestFramework/Coverage/CoverageChecker.php | 2 +- tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestFramework/Coverage/CoverageChecker.php b/src/TestFramework/Coverage/CoverageChecker.php index fe5ee8711..84f8cb0c0 100644 --- a/src/TestFramework/Coverage/CoverageChecker.php +++ b/src/TestFramework/Coverage/CoverageChecker.php @@ -103,7 +103,7 @@ public function checkCoverageRequirements(): void Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again +- Enable Xdebug and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT diff --git a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php index 75bf53d7c..6093aa5ce 100644 --- a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php +++ b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php @@ -142,7 +142,7 @@ public function test_it_needs_code_coverage_generator_enabled_if_coverage_is_not Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again +- Enable Xdebug and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT From f71de6863e67193e899ec0be6b0a6706832de0f7 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 11:33:28 +0900 Subject: [PATCH 03/38] Add a test --- .../phpunit/Process/CoveredPhpProcessTest.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/phpunit/Process/CoveredPhpProcessTest.php diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php new file mode 100644 index 000000000..1574a0041 --- /dev/null +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -0,0 +1,68 @@ +assertInstanceOf(Process::class, $process); + } + + public function test_it_takes_command_line(): void + { + $process = new CoveredPhpProcess(['foo']); + $this->assertSame("'foo'", $process->getCommandLine()); + } + + /** + * @group integration + */ + public function test_it_injects_xdebug_env_vars(): void + { + $process = new CoveredPhpProcess(['env']); + $process->run(); + + $this->assertStringContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + } +} From fd77c35c973c4ebf69ee79c11c7d56162898b2ce Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 12:27:57 +0900 Subject: [PATCH 04/38] Address PCOV --- devTools/xdebug-coverage.ini | 1 - src/Process/CoveredPhpProcess.php | 14 +++++++++----- tests/phpunit/Process/CoveredPhpProcessTest.php | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/devTools/xdebug-coverage.ini b/devTools/xdebug-coverage.ini index cea362e77..e69de29bb 100644 --- a/devTools/xdebug-coverage.ini +++ b/devTools/xdebug-coverage.ini @@ -1 +0,0 @@ -xdebug.mode=coverage diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php index 51cc010fd..7c849bf02 100644 --- a/src/Process/CoveredPhpProcess.php +++ b/src/Process/CoveredPhpProcess.php @@ -36,6 +36,7 @@ namespace Infection\Process; use function array_merge; +use function extension_loaded; use Symfony\Component\Process\Process; /** @@ -46,7 +47,8 @@ * * As of now we only cover Xdebug, adding XDEBUG_MODE environment variable to ensure it * is properly activated. Since we can't know if Xdebug was offloaded, we add this env - * variable at all times. + * variable at most times, except when there's PCOV loaded: chances are Xdebug is not + * required when PCOV already used for coverage. */ final class CoveredPhpProcess extends Process { @@ -55,10 +57,12 @@ final class CoveredPhpProcess extends Process */ public function start(?callable $callback = null, ?array $env = null): void { - $env = array_merge($env ?? [], [ - 'XDEBUG_MODE' => 'debug', - ]); + if (!extension_loaded('pcov')) { + $env = array_merge($env ?? [], [ + 'XDEBUG_MODE' => 'debug', + ]); + } - parent::start($callback, $env); + parent::start($callback, $env ?? []); } } diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index 1574a0041..7484cddd5 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -35,6 +35,7 @@ namespace Infection\Tests\Process; +use function extension_loaded; use Infection\Process\CoveredPhpProcess; use const PHP_EOL; use PHPUnit\Framework\TestCase; @@ -63,6 +64,10 @@ public function test_it_injects_xdebug_env_vars(): void $process = new CoveredPhpProcess(['env']); $process->run(); - $this->assertStringContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + if (!extension_loaded('pcov')) { + $this->assertStringContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + } else { + $this->assertStringNotContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + } } } From 90017c629e83aa2683cc39ecbf0cbb4d110c66bd Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 12:29:14 +0900 Subject: [PATCH 05/38] Simplify Dockerfiles --- devTools/Dockerfile-php74-xdebug | 2 +- devTools/Dockerfile-php80-xdebug | 2 +- devTools/xdebug-coverage.ini | 0 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 devTools/xdebug-coverage.ini diff --git a/devTools/Dockerfile-php74-xdebug b/devTools/Dockerfile-php74-xdebug index cd5a50ae5..4f10f2393 100644 --- a/devTools/Dockerfile-php74-xdebug +++ b/devTools/Dockerfile-php74-xdebug @@ -28,7 +28,7 @@ RUN apk add --no-cache \ zip COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -COPY devTools/memory-limit.ini devTools/xdebug-coverage.ini ${PHP_INI_DIR}/conf.d/ +COPY devTools/memory-limit.ini ${PHP_INI_DIR}/conf.d/ RUN adduser -h /opt/infection -s /bin/bash -D infection diff --git a/devTools/Dockerfile-php80-xdebug b/devTools/Dockerfile-php80-xdebug index 9996a6bf9..56ebccc1d 100644 --- a/devTools/Dockerfile-php80-xdebug +++ b/devTools/Dockerfile-php80-xdebug @@ -27,7 +27,7 @@ RUN apk add --no-cache \ zip COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -COPY devTools/memory-limit.ini devTools/xdebug-coverage.ini ${PHP_INI_DIR}/conf.d/ +COPY devTools/memory-limit.ini ${PHP_INI_DIR}/conf.d/ RUN adduser -h /opt/infection -s /bin/bash -D infection diff --git a/devTools/xdebug-coverage.ini b/devTools/xdebug-coverage.ini deleted file mode 100644 index e69de29bb..000000000 From 6dd84fec0403694d28be08deadde21dc5233820a Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 12:43:54 +0900 Subject: [PATCH 06/38] Fix PHPStan --- devTools/phpstan-src-baseline.neon | 5 +++++ devTools/phpstan-tests.neon | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devTools/phpstan-src-baseline.neon b/devTools/phpstan-src-baseline.neon index 91cb14cb7..ee2febb55 100644 --- a/devTools/phpstan-src-baseline.neon +++ b/devTools/phpstan-src-baseline.neon @@ -255,6 +255,11 @@ parameters: count: 1 path: ../src/PhpParser/Visitor/ReflectionVisitor.php + - + message: "#^Parameter \\#2 \\$env \\(array\\\\|null\\) of method Infection\\\\Process\\\\CoveredPhpProcess\\:\\:start\\(\\) should be contravariant with parameter \\$env \\(array\\) of method Symfony\\\\Component\\\\Process\\\\Process\\:\\:start\\(\\)$#" + count: 1 + path: ../src/Process/CoveredPhpProcess.php + - message: "#^Parameter \\#2 \\$env \\(array\\\\|null\\) of method Infection\\\\Process\\\\OriginalPhpProcess\\:\\:start\\(\\) should be contravariant with parameter \\$env \\(array\\) of method Symfony\\\\Component\\\\Process\\\\Process\\:\\:start\\(\\)$#" count: 1 diff --git a/devTools/phpstan-tests.neon b/devTools/phpstan-tests.neon index 2b66e3a86..14b114bdc 100644 --- a/devTools/phpstan-tests.neon +++ b/devTools/phpstan-tests.neon @@ -16,7 +16,7 @@ parameters: - '#^Cannot call method (willReturn|shouldBeCalledTimes)\(\) on iterable\.$#' - '#Offset .*\\.* does not exist on array.*#' - '#Dynamic call to static method PHPUnit\\Framework\\.*::.*#' - - '#Call to method PHPUnit\\Framework\\Assert::.* with array.* and array.* will always evaluate to false#' + - '#Call to method PHPUnit\\Framework\\Assert::.* with .* and .* will always evaluate to (false|true)#' - '#^PHPDoc tag @var for variable \$sourceFilesCollectorProphecy contains unresolvable type#' - path: '../tests/phpunit/TestFramework/PhpUnit/Config/Builder/InitialConfigBuilderTest.php' From a8a3db7e7f724957b3c36f2c6e9b781ce4435893 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 12:48:37 +0900 Subject: [PATCH 07/38] Fix tests in Windows --- tests/phpunit/Process/CoveredPhpProcessTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index 7484cddd5..add153a64 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -53,7 +53,7 @@ public function test_it_extends_symfony_process(): void public function test_it_takes_command_line(): void { $process = new CoveredPhpProcess(['foo']); - $this->assertSame("'foo'", $process->getCommandLine()); + $this->assertStringContainsString('foo', $process->getCommandLine()); } /** From a645bee27bcff4f9db14a4be265bfc5349766664 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Tue, 4 May 2021 12:57:13 +0900 Subject: [PATCH 08/38] Reduce epsilon --- .../Coverage/JUnit/TestLocationBucketSorterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/TestFramework/Coverage/JUnit/TestLocationBucketSorterTest.php b/tests/phpunit/TestFramework/Coverage/JUnit/TestLocationBucketSorterTest.php index 442ef7200..e1170bca3 100644 --- a/tests/phpunit/TestFramework/Coverage/JUnit/TestLocationBucketSorterTest.php +++ b/tests/phpunit/TestFramework/Coverage/JUnit/TestLocationBucketSorterTest.php @@ -189,7 +189,7 @@ public function test_it_sorts_faster_than_quicksort(ArrayIterator $uniqueTestLoc $totalQuickSort += microtime(true) - $start; } - $this->assertGreaterThanOrEqual(0.01, abs($totalQuickSort - $totalBucketSort)); + $this->assertGreaterThanOrEqual(0.001, abs($totalQuickSort - $totalBucketSort)); } public static function locationsArrayProvider(): iterable From 99162ef56249dc71b590f27deb53f49b0d1fe9c3 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 5 May 2021 01:04:36 +0900 Subject: [PATCH 09/38] Should use XDEBUG_MODE=coverage --- src/Process/CoveredPhpProcess.php | 2 +- tests/phpunit/Process/CoveredPhpProcessTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php index 7c849bf02..e73282a1a 100644 --- a/src/Process/CoveredPhpProcess.php +++ b/src/Process/CoveredPhpProcess.php @@ -59,7 +59,7 @@ public function start(?callable $callback = null, ?array $env = null): void { if (!extension_loaded('pcov')) { $env = array_merge($env ?? [], [ - 'XDEBUG_MODE' => 'debug', + 'XDEBUG_MODE' => 'coverage', ]); } diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index add153a64..ccbedd7b2 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -65,9 +65,9 @@ public function test_it_injects_xdebug_env_vars(): void $process->run(); if (!extension_loaded('pcov')) { - $this->assertStringContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + $this->assertStringContainsString('XDEBUG_MODE=coverage' . PHP_EOL, $process->getOutput()); } else { - $this->assertStringNotContainsString('XDEBUG_MODE=debug' . PHP_EOL, $process->getOutput()); + $this->assertStringNotContainsString('XDEBUG_MODE=coverage' . PHP_EOL, $process->getOutput()); } } } From 6f728692b03977e49dbc071253f9034c0423b1b7 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 5 May 2021 01:05:57 +0900 Subject: [PATCH 10/38] Add Xdebug 2 to CI --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a2d2219cb..d99875644 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,7 @@ jobs: - { operating-system: 'windows-latest', php-version: '7.4', dependencies: '', coverage-driver: 'xdebug' } - { operating-system: 'ubuntu-latest', php-version: '7.4', dependencies: '--prefer-lowest', coverage-driver: 'pcov' } - { operating-system: 'ubuntu-latest', php-version: '8.0', dependencies: '--ignore-platform-req=php', coverage-driver: 'pcov' } + - { operating-system: 'ubuntu-latest', php-version: '7.4', dependencies: '', coverage-driver: 'xdebug2' } continue-on-error: ${{ matrix.php-version == '8.0' }} name: CI on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }} ${{ matrix.dependencies }} From 4999b9a48f1c156c90a10a334dc311038ca45080 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 5 May 2021 01:07:00 +0900 Subject: [PATCH 11/38] Fix tests on Windows by not assuming a new line --- tests/phpunit/Process/CoveredPhpProcessTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index ccbedd7b2..804621e03 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -65,9 +65,9 @@ public function test_it_injects_xdebug_env_vars(): void $process->run(); if (!extension_loaded('pcov')) { - $this->assertStringContainsString('XDEBUG_MODE=coverage' . PHP_EOL, $process->getOutput()); + $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { - $this->assertStringNotContainsString('XDEBUG_MODE=coverage' . PHP_EOL, $process->getOutput()); + $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } } } From 97ba8e1b1e280c79d61f36cd65bb3ad8337f121b Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 5 May 2021 01:09:02 +0900 Subject: [PATCH 12/38] cs --- tests/phpunit/Process/CoveredPhpProcessTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index 804621e03..a172a03d1 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -37,7 +37,6 @@ use function extension_loaded; use Infection\Process\CoveredPhpProcess; -use const PHP_EOL; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; From 41433eeab7e33de5279e39cea8cd0ac0a4cddb04 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 08:20:23 +0900 Subject: [PATCH 13/38] Revert everything to where it was --- src/Process/CoveredPhpProcess.php | 68 ------------------ .../Factory/InitialTestsRunProcessFactory.php | 3 +- .../Coverage/CoverageChecker.php | 2 +- .../phpunit/Process/CoveredPhpProcessTest.php | 72 ------------------- .../InitialTestsRunProcessFactoryTest.php | 2 - .../Coverage/CoverageCheckerTest.php | 2 +- 6 files changed, 3 insertions(+), 146 deletions(-) delete mode 100644 src/Process/CoveredPhpProcess.php delete mode 100644 tests/phpunit/Process/CoveredPhpProcessTest.php diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php deleted file mode 100644 index e73282a1a..000000000 --- a/src/Process/CoveredPhpProcess.php +++ /dev/null @@ -1,68 +0,0 @@ -|null $env - */ - public function start(?callable $callback = null, ?array $env = null): void - { - if (!extension_loaded('pcov')) { - $env = array_merge($env ?? [], [ - 'XDEBUG_MODE' => 'coverage', - ]); - } - - parent::start($callback, $env ?? []); - } -} diff --git a/src/Process/Factory/InitialTestsRunProcessFactory.php b/src/Process/Factory/InitialTestsRunProcessFactory.php index 553af5a3f..2cc3f6dd1 100644 --- a/src/Process/Factory/InitialTestsRunProcessFactory.php +++ b/src/Process/Factory/InitialTestsRunProcessFactory.php @@ -37,7 +37,6 @@ use Composer\InstalledVersions; use Infection\AbstractTestFramework\TestFrameworkAdapter; -use Infection\Process\CoveredPhpProcess; use Infection\Process\OriginalPhpProcess; use function method_exists; use Symfony\Component\Process\Process; @@ -67,7 +66,7 @@ public function createProcess( bool $skipCoverage ): Process { // If we're expecting to receive a code coverage, test process must run in a vanilla environment - $processClass = $skipCoverage ? CoveredPhpProcess::class : OriginalPhpProcess::class; + $processClass = $skipCoverage ? Process::class : OriginalPhpProcess::class; /** @var Process $process */ $process = new $processClass( diff --git a/src/TestFramework/Coverage/CoverageChecker.php b/src/TestFramework/Coverage/CoverageChecker.php index 7e48ab5c1..b2fb2cf62 100644 --- a/src/TestFramework/Coverage/CoverageChecker.php +++ b/src/TestFramework/Coverage/CoverageChecker.php @@ -103,7 +103,7 @@ public function checkCoverageRequirements(): void Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug and run Infection again +- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php deleted file mode 100644 index a172a03d1..000000000 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ /dev/null @@ -1,72 +0,0 @@ -assertInstanceOf(Process::class, $process); - } - - public function test_it_takes_command_line(): void - { - $process = new CoveredPhpProcess(['foo']); - $this->assertStringContainsString('foo', $process->getCommandLine()); - } - - /** - * @group integration - */ - public function test_it_injects_xdebug_env_vars(): void - { - $process = new CoveredPhpProcess(['env']); - $process->run(); - - if (!extension_loaded('pcov')) { - $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); - } else { - $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); - } - } -} diff --git a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php index 5ec773fa5..87ca5433a 100644 --- a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php +++ b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php @@ -36,7 +36,6 @@ namespace Infection\Tests\Process\Factory; use Infection\AbstractTestFramework\TestFrameworkAdapter; -use Infection\Process\CoveredPhpProcess; use Infection\Process\Factory\InitialTestsRunProcessFactory; use Infection\Process\OriginalPhpProcess; use const PHP_OS_FAMILY; @@ -87,7 +86,6 @@ public function test_it_creates_a_process_with_coverage_skipped(): void $this->assertNull($process->getTimeout()); $this->assertNotInstanceOf(OriginalPhpProcess::class, $process); - $this->assertInstanceOf(CoveredPhpProcess::class, $process); } public function test_it_creates_a_process_with_coverage(): void diff --git a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php index 6093aa5ce..75bf53d7c 100644 --- a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php +++ b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php @@ -142,7 +142,7 @@ public function test_it_needs_code_coverage_generator_enabled_if_coverage_is_not Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug and run Infection again +- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT From aa1e089baf49ba86f4ebe9512f033efd2316296b Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 08:25:56 +0900 Subject: [PATCH 14/38] Disable XDebug on CI --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa8a50ec8..7b61ebe23 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,7 +37,7 @@ jobs: with: php-version: ${{ matrix.php-version }} coverage: ${{ matrix.coverage-driver }} - ini-values: memory_limit=512M + ini-values: memory_limit=512M, xdebug.mode=off tools: composer:v2 - name: Get composer cache directory From fd56f5d4d3f121dffe048c43bd4f60a154c973a7 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 09:05:50 +0900 Subject: [PATCH 15/38] Put everything back together after we proved it works Revert "Revert everything to where it was" This reverts commit 41433eeab7e33de5279e39cea8cd0ac0a4cddb04. --- src/Process/CoveredPhpProcess.php | 68 ++++++++++++++++++ .../Factory/InitialTestsRunProcessFactory.php | 3 +- .../Coverage/CoverageChecker.php | 2 +- .../phpunit/Process/CoveredPhpProcessTest.php | 72 +++++++++++++++++++ .../InitialTestsRunProcessFactoryTest.php | 2 + .../Coverage/CoverageCheckerTest.php | 2 +- 6 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 src/Process/CoveredPhpProcess.php create mode 100644 tests/phpunit/Process/CoveredPhpProcessTest.php diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php new file mode 100644 index 000000000..e73282a1a --- /dev/null +++ b/src/Process/CoveredPhpProcess.php @@ -0,0 +1,68 @@ +|null $env + */ + public function start(?callable $callback = null, ?array $env = null): void + { + if (!extension_loaded('pcov')) { + $env = array_merge($env ?? [], [ + 'XDEBUG_MODE' => 'coverage', + ]); + } + + parent::start($callback, $env ?? []); + } +} diff --git a/src/Process/Factory/InitialTestsRunProcessFactory.php b/src/Process/Factory/InitialTestsRunProcessFactory.php index 2cc3f6dd1..553af5a3f 100644 --- a/src/Process/Factory/InitialTestsRunProcessFactory.php +++ b/src/Process/Factory/InitialTestsRunProcessFactory.php @@ -37,6 +37,7 @@ use Composer\InstalledVersions; use Infection\AbstractTestFramework\TestFrameworkAdapter; +use Infection\Process\CoveredPhpProcess; use Infection\Process\OriginalPhpProcess; use function method_exists; use Symfony\Component\Process\Process; @@ -66,7 +67,7 @@ public function createProcess( bool $skipCoverage ): Process { // If we're expecting to receive a code coverage, test process must run in a vanilla environment - $processClass = $skipCoverage ? Process::class : OriginalPhpProcess::class; + $processClass = $skipCoverage ? CoveredPhpProcess::class : OriginalPhpProcess::class; /** @var Process $process */ $process = new $processClass( diff --git a/src/TestFramework/Coverage/CoverageChecker.php b/src/TestFramework/Coverage/CoverageChecker.php index b2fb2cf62..7e48ab5c1 100644 --- a/src/TestFramework/Coverage/CoverageChecker.php +++ b/src/TestFramework/Coverage/CoverageChecker.php @@ -103,7 +103,7 @@ public function checkCoverageRequirements(): void Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again +- Enable Xdebug and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php new file mode 100644 index 000000000..a172a03d1 --- /dev/null +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -0,0 +1,72 @@ +assertInstanceOf(Process::class, $process); + } + + public function test_it_takes_command_line(): void + { + $process = new CoveredPhpProcess(['foo']); + $this->assertStringContainsString('foo', $process->getCommandLine()); + } + + /** + * @group integration + */ + public function test_it_injects_xdebug_env_vars(): void + { + $process = new CoveredPhpProcess(['env']); + $process->run(); + + if (!extension_loaded('pcov')) { + $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); + } else { + $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); + } + } +} diff --git a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php index 87ca5433a..5ec773fa5 100644 --- a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php +++ b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php @@ -36,6 +36,7 @@ namespace Infection\Tests\Process\Factory; use Infection\AbstractTestFramework\TestFrameworkAdapter; +use Infection\Process\CoveredPhpProcess; use Infection\Process\Factory\InitialTestsRunProcessFactory; use Infection\Process\OriginalPhpProcess; use const PHP_OS_FAMILY; @@ -86,6 +87,7 @@ public function test_it_creates_a_process_with_coverage_skipped(): void $this->assertNull($process->getTimeout()); $this->assertNotInstanceOf(OriginalPhpProcess::class, $process); + $this->assertInstanceOf(CoveredPhpProcess::class, $process); } public function test_it_creates_a_process_with_coverage(): void diff --git a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php index 75bf53d7c..6093aa5ce 100644 --- a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php +++ b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php @@ -142,7 +142,7 @@ public function test_it_needs_code_coverage_generator_enabled_if_coverage_is_not Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again +- Enable Xdebug and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT From 7b12fc44b8c6d14ea514ca5a8333014038fd72ca Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 17:08:56 +0900 Subject: [PATCH 16/38] We can know that Xdebug was offloaded --- src/Process/CoveredPhpProcess.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php index e73282a1a..69ebb9abe 100644 --- a/src/Process/CoveredPhpProcess.php +++ b/src/Process/CoveredPhpProcess.php @@ -36,7 +36,7 @@ namespace Infection\Process; use function array_merge; -use function extension_loaded; +use Composer\XdebugHandler\XdebugHandler; use Symfony\Component\Process\Process; /** @@ -46,9 +46,7 @@ * without any extra user interaction. * * As of now we only cover Xdebug, adding XDEBUG_MODE environment variable to ensure it - * is properly activated. Since we can't know if Xdebug was offloaded, we add this env - * variable at most times, except when there's PCOV loaded: chances are Xdebug is not - * required when PCOV already used for coverage. + * is properly activated. We only add this variable if we know that Xdebug was offloaded. */ final class CoveredPhpProcess extends Process { @@ -57,7 +55,7 @@ final class CoveredPhpProcess extends Process */ public function start(?callable $callback = null, ?array $env = null): void { - if (!extension_loaded('pcov')) { + if (XdebugHandler::getSkippedVersion() !== '') { $env = array_merge($env ?? [], [ 'XDEBUG_MODE' => 'coverage', ]); From 80700823a3c8c3cfb29bb1d4a1acc95c1a195068 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 17:11:16 +0900 Subject: [PATCH 17/38] Return useful notices --- src/TestFramework/Coverage/CoverageChecker.php | 2 +- tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestFramework/Coverage/CoverageChecker.php b/src/TestFramework/Coverage/CoverageChecker.php index 7e48ab5c1..b2fb2cf62 100644 --- a/src/TestFramework/Coverage/CoverageChecker.php +++ b/src/TestFramework/Coverage/CoverageChecker.php @@ -103,7 +103,7 @@ public function checkCoverageRequirements(): void Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug and run Infection again +- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT diff --git a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php index 6093aa5ce..75bf53d7c 100644 --- a/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php +++ b/tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php @@ -142,7 +142,7 @@ public function test_it_needs_code_coverage_generator_enabled_if_coverage_is_not Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either: - Enable pcov and run Infection again - Use phpdbg, e.g. `phpdbg -qrr infection` -- Enable Xdebug and run Infection again +- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again - Use the "--coverage" option with path to the existing coverage report - Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so` TXT From ceee8e247422d5846e1cd25af0a998375dab64ce Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 17:13:54 +0900 Subject: [PATCH 18/38] Fix tests --- tests/phpunit/Process/CoveredPhpProcessTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index a172a03d1..2d7b6b424 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -35,7 +35,7 @@ namespace Infection\Tests\Process; -use function extension_loaded; +use Composer\XdebugHandler\XdebugHandler; use Infection\Process\CoveredPhpProcess; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; @@ -63,7 +63,7 @@ public function test_it_injects_xdebug_env_vars(): void $process = new CoveredPhpProcess(['env']); $process->run(); - if (!extension_loaded('pcov')) { + if (XdebugHandler::getSkippedVersion() !== '') { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); From 9f6d31380c8a099a4c5fa5027f42dbb66cfb3296 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 17:22:05 +0900 Subject: [PATCH 19/38] Fix it --- tests/phpunit/Process/CoveredPhpProcessTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index 2d7b6b424..a06afdb21 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -61,12 +61,14 @@ public function test_it_takes_command_line(): void public function test_it_injects_xdebug_env_vars(): void { $process = new CoveredPhpProcess(['env']); - $process->run(); + $process->run(null, ['TESTING' => 'test']); if (XdebugHandler::getSkippedVersion() !== '') { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } + + $this->assertStringContainsString('TESTING=test', $process->getOutput()); } } From ae7270306cf3c3678ffd3795b34db7a860ccd4a1 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 17:54:24 +0900 Subject: [PATCH 20/38] Another check for Xdebug --- devTools/Dockerfile | 2 +- devTools/phpstan-src.neon | 3 +++ devTools/phpstan-tests.neon | 3 +++ devTools/xdebug-coverage.ini | 1 + src/Process/CoveredPhpProcess.php | 13 +++++++++++-- tests/phpunit/Process/CoveredPhpProcessTest.php | 3 ++- 6 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 devTools/xdebug-coverage.ini diff --git a/devTools/Dockerfile b/devTools/Dockerfile index eb6f8519e..c2d44757f 100644 --- a/devTools/Dockerfile +++ b/devTools/Dockerfile @@ -30,7 +30,7 @@ RUN apk add --no-cache \ zip COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -COPY memory-limit.ini ${PHP_INI_DIR}/conf.d/ +COPY memory-limit.ini xdebug-coverage.ini ${PHP_INI_DIR}/conf.d/ RUN adduser -h /opt/infection -s /bin/bash -D infection diff --git a/devTools/phpstan-src.neon b/devTools/phpstan-src.neon index 8eb3d8d1b..d5e78645a 100644 --- a/devTools/phpstan-src.neon +++ b/devTools/phpstan-src.neon @@ -51,6 +51,9 @@ parameters: - path: '../src/FileSystem/DummyFileSystem.php' message: '#Infection\\FileSystem\\DummyFileSystem#' + - + path: '../src/Process/CoveredPhpProcess.php' + message: '#Function ini_get is unsafe to use#' level: max paths: - ../src diff --git a/devTools/phpstan-tests.neon b/devTools/phpstan-tests.neon index a5a2ae67f..d6fd20ac0 100644 --- a/devTools/phpstan-tests.neon +++ b/devTools/phpstan-tests.neon @@ -26,6 +26,9 @@ parameters: message: "#^Variable method call on Infection\\\\Tests\\\\FileSystem\\\\Finder\\\\MockVendor\\.$#" count: 1 path: ../tests/phpunit/FileSystem/Finder/TestFrameworkFinderTest.php + - + message: '#Function ini_get is unsafe to use#' + path: ../tests/phpunit/Process/CoveredPhpProcessTest.php level: 4 paths: - ../tests/phpunit diff --git a/devTools/xdebug-coverage.ini b/devTools/xdebug-coverage.ini new file mode 100644 index 000000000..9d4987171 --- /dev/null +++ b/devTools/xdebug-coverage.ini @@ -0,0 +1 @@ +xdebug.mode=off diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php index 69ebb9abe..d3339f612 100644 --- a/src/Process/CoveredPhpProcess.php +++ b/src/Process/CoveredPhpProcess.php @@ -37,6 +37,7 @@ use function array_merge; use Composer\XdebugHandler\XdebugHandler; +use function ini_get as ini_get_unsafe; use Symfony\Component\Process\Process; /** @@ -46,7 +47,9 @@ * without any extra user interaction. * * As of now we only cover Xdebug, adding XDEBUG_MODE environment variable to ensure it - * is properly activated. We only add this variable if we know that Xdebug was offloaded. + * is properly activated. We add this variable if we know that Xdebug was offloaded, or + * if we know Xdebug is loaded since we can't know it coverage option is enabled (setting + * XDEBUG_MODE won't change xdebug.mode). */ final class CoveredPhpProcess extends Process { @@ -55,7 +58,13 @@ final class CoveredPhpProcess extends Process */ public function start(?callable $callback = null, ?array $env = null): void { - if (XdebugHandler::getSkippedVersion() !== '') { + + if ( + XdebugHandler::getSkippedVersion() !== '' || + // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have + // it too, but it has coverage enabled at all times. + ini_get_unsafe('xdebug.mode') !== false + ) { $env = array_merge($env ?? [], [ 'XDEBUG_MODE' => 'coverage', ]); diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index a06afdb21..51684f67f 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -39,6 +39,7 @@ use Infection\Process\CoveredPhpProcess; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; +use function ini_get as ini_get_unsafe; final class CoveredPhpProcessTest extends TestCase { @@ -63,7 +64,7 @@ public function test_it_injects_xdebug_env_vars(): void $process = new CoveredPhpProcess(['env']); $process->run(null, ['TESTING' => 'test']); - if (XdebugHandler::getSkippedVersion() !== '') { + if (XdebugHandler::getSkippedVersion() !== '' || ini_get_unsafe('xdebug.mode') !== false) { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); From c3aa985b467ee3a2b7beadb63cf113e0a3dccb71 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:08:52 +0900 Subject: [PATCH 21/38] Code Style --- src/Process/CoveredPhpProcess.php | 1 - tests/phpunit/Process/CoveredPhpProcessTest.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php index d3339f612..55a943beb 100644 --- a/src/Process/CoveredPhpProcess.php +++ b/src/Process/CoveredPhpProcess.php @@ -58,7 +58,6 @@ final class CoveredPhpProcess extends Process */ public function start(?callable $callback = null, ?array $env = null): void { - if ( XdebugHandler::getSkippedVersion() !== '' || // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/CoveredPhpProcessTest.php index 51684f67f..0459b5577 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/CoveredPhpProcessTest.php @@ -37,9 +37,9 @@ use Composer\XdebugHandler\XdebugHandler; use Infection\Process\CoveredPhpProcess; +use function ini_get as ini_get_unsafe; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; -use function ini_get as ini_get_unsafe; final class CoveredPhpProcessTest extends TestCase { From 9925cafcba284e28b513f4a050a868efe39a166b Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:32:55 +0900 Subject: [PATCH 22/38] Update OriginalPhpProcess --- src/Process/CoveredPhpProcess.php | 74 ------------------- .../Factory/InitialTestsRunProcessFactory.php | 3 +- src/Process/OriginalPhpProcess.php | 14 ++++ .../Coverage/CoverageChecker.php | 2 + .../ProjectCode/ProjectCodeProvider.php | 2 - ...essTest.php => OriginalPhpProcessTest.php} | 10 +-- 6 files changed, 22 insertions(+), 83 deletions(-) delete mode 100644 src/Process/CoveredPhpProcess.php rename tests/phpunit/Process/{CoveredPhpProcessTest.php => OriginalPhpProcessTest.php} (91%) diff --git a/src/Process/CoveredPhpProcess.php b/src/Process/CoveredPhpProcess.php deleted file mode 100644 index 55a943beb..000000000 --- a/src/Process/CoveredPhpProcess.php +++ /dev/null @@ -1,74 +0,0 @@ -|null $env - */ - public function start(?callable $callback = null, ?array $env = null): void - { - if ( - XdebugHandler::getSkippedVersion() !== '' || - // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have - // it too, but it has coverage enabled at all times. - ini_get_unsafe('xdebug.mode') !== false - ) { - $env = array_merge($env ?? [], [ - 'XDEBUG_MODE' => 'coverage', - ]); - } - - parent::start($callback, $env ?? []); - } -} diff --git a/src/Process/Factory/InitialTestsRunProcessFactory.php b/src/Process/Factory/InitialTestsRunProcessFactory.php index 553af5a3f..2cc3f6dd1 100644 --- a/src/Process/Factory/InitialTestsRunProcessFactory.php +++ b/src/Process/Factory/InitialTestsRunProcessFactory.php @@ -37,7 +37,6 @@ use Composer\InstalledVersions; use Infection\AbstractTestFramework\TestFrameworkAdapter; -use Infection\Process\CoveredPhpProcess; use Infection\Process\OriginalPhpProcess; use function method_exists; use Symfony\Component\Process\Process; @@ -67,7 +66,7 @@ public function createProcess( bool $skipCoverage ): Process { // If we're expecting to receive a code coverage, test process must run in a vanilla environment - $processClass = $skipCoverage ? CoveredPhpProcess::class : OriginalPhpProcess::class; + $processClass = $skipCoverage ? Process::class : OriginalPhpProcess::class; /** @var Process $process */ $process = new $processClass( diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index b110563b2..475d7eee8 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -35,7 +35,10 @@ namespace Infection\Process; +use function array_merge; use Composer\XdebugHandler\PhpConfig; +use Composer\XdebugHandler\XdebugHandler; +use function ini_get as ini_get_unsafe; use Symfony\Component\Process\Process; /** @@ -57,6 +60,17 @@ public function start(?callable $callback = null, ?array $env = null): void $phpConfig = new PhpConfig(); $phpConfig->useOriginal(); + if ( + XdebugHandler::getSkippedVersion() !== '' || + // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have + // it too, but it has coverage enabled at all times. + ini_get_unsafe('xdebug.mode') !== false + ) { + $env = array_merge($env ?? [], [ + 'XDEBUG_MODE' => 'coverage', + ]); + } + parent::start($callback, $env ?? []); $phpConfig->usePersistent(); diff --git a/src/TestFramework/Coverage/CoverageChecker.php b/src/TestFramework/Coverage/CoverageChecker.php index b2fb2cf62..7266d9bca 100644 --- a/src/TestFramework/Coverage/CoverageChecker.php +++ b/src/TestFramework/Coverage/CoverageChecker.php @@ -42,6 +42,7 @@ use Infection\FileSystem\Locator\FileNotFound; use Infection\TestFramework\Coverage\JUnit\JUnitReportLocator; use Infection\TestFramework\Coverage\XmlReport\IndexXmlCoverageLocator; +use function ini_get as ini_get_unsafe; use const PHP_EOL; use const PHP_SAPI; use function Safe\preg_match; @@ -175,6 +176,7 @@ private function hasCoverageGeneratorEnabled(): bool || XdebugHandler::isXdebugActive() || extension_loaded('pcov') || XdebugHandler::getSkippedVersion() !== '' + || ini_get_unsafe('xdebug.mode') !== false || $this->isXdebugIncludedInInitialTestPhpOptions() || $this->isPcovIncludedInInitialTestPhpOptions(); } diff --git a/tests/phpunit/AutoReview/ProjectCode/ProjectCodeProvider.php b/tests/phpunit/AutoReview/ProjectCode/ProjectCodeProvider.php index c1702e802..f202cada6 100644 --- a/tests/phpunit/AutoReview/ProjectCode/ProjectCodeProvider.php +++ b/tests/phpunit/AutoReview/ProjectCode/ProjectCodeProvider.php @@ -65,7 +65,6 @@ use Infection\Mutant\DetectionStatus; use Infection\Mutation\MutationAttributeKeys; use Infection\Mutator\NodeMutationGenerator; -use Infection\Process\OriginalPhpProcess; use Infection\Process\Runner\IndexedProcessBearer; use Infection\TestFramework\AdapterInstaller; use Infection\TestFramework\Coverage\JUnit\TestFileTimeData; @@ -100,7 +99,6 @@ final class ProjectCodeProvider RunCommand::class, Application::class, ProgressFormatter::class, - OriginalPhpProcess::class, ComposerExecutableFinder::class, StrykerCurlClient::class, MutationGeneratingConsoleLoggerSubscriber::class, diff --git a/tests/phpunit/Process/CoveredPhpProcessTest.php b/tests/phpunit/Process/OriginalPhpProcessTest.php similarity index 91% rename from tests/phpunit/Process/CoveredPhpProcessTest.php rename to tests/phpunit/Process/OriginalPhpProcessTest.php index 0459b5577..b0a860dda 100644 --- a/tests/phpunit/Process/CoveredPhpProcessTest.php +++ b/tests/phpunit/Process/OriginalPhpProcessTest.php @@ -36,23 +36,23 @@ namespace Infection\Tests\Process; use Composer\XdebugHandler\XdebugHandler; -use Infection\Process\CoveredPhpProcess; +use Infection\Process\OriginalPhpProcess; use function ini_get as ini_get_unsafe; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; -final class CoveredPhpProcessTest extends TestCase +final class OriginalPhpProcessTest extends TestCase { public function test_it_extends_symfony_process(): void { - $process = new CoveredPhpProcess([]); + $process = new OriginalPhpProcess([]); $this->assertInstanceOf(Process::class, $process); } public function test_it_takes_command_line(): void { - $process = new CoveredPhpProcess(['foo']); + $process = new OriginalPhpProcess(['foo']); $this->assertStringContainsString('foo', $process->getCommandLine()); } @@ -61,7 +61,7 @@ public function test_it_takes_command_line(): void */ public function test_it_injects_xdebug_env_vars(): void { - $process = new CoveredPhpProcess(['env']); + $process = new OriginalPhpProcess(['env']); $process->run(null, ['TESTING' => 'test']); if (XdebugHandler::getSkippedVersion() !== '' || ini_get_unsafe('xdebug.mode') !== false) { From cccb00fe781b35974de2e747802648af9c7431a0 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:35:46 +0900 Subject: [PATCH 23/38] Fix SA issues --- devTools/phpstan-src.neon | 5 ++++- devTools/phpstan-tests.neon | 2 +- .../Process/Factory/InitialTestsRunProcessFactoryTest.php | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/devTools/phpstan-src.neon b/devTools/phpstan-src.neon index d5e78645a..a137c7b1b 100644 --- a/devTools/phpstan-src.neon +++ b/devTools/phpstan-src.neon @@ -52,7 +52,10 @@ parameters: path: '../src/FileSystem/DummyFileSystem.php' message: '#Infection\\FileSystem\\DummyFileSystem#' - - path: '../src/Process/CoveredPhpProcess.php' + path: '../src/Process/OriginalPhpProcess.php' + message: '#Function ini_get is unsafe to use#' + - + path: '../src/TestFramework/Coverage/CoverageChecker.php' message: '#Function ini_get is unsafe to use#' level: max paths: diff --git a/devTools/phpstan-tests.neon b/devTools/phpstan-tests.neon index d6fd20ac0..1a1ffef74 100644 --- a/devTools/phpstan-tests.neon +++ b/devTools/phpstan-tests.neon @@ -28,7 +28,7 @@ parameters: path: ../tests/phpunit/FileSystem/Finder/TestFrameworkFinderTest.php - message: '#Function ini_get is unsafe to use#' - path: ../tests/phpunit/Process/CoveredPhpProcessTest.php + path: ../tests/phpunit/Process/OriginalPhpProcessTest.php level: 4 paths: - ../tests/phpunit diff --git a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php index 5ec773fa5..87ca5433a 100644 --- a/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php +++ b/tests/phpunit/Process/Factory/InitialTestsRunProcessFactoryTest.php @@ -36,7 +36,6 @@ namespace Infection\Tests\Process\Factory; use Infection\AbstractTestFramework\TestFrameworkAdapter; -use Infection\Process\CoveredPhpProcess; use Infection\Process\Factory\InitialTestsRunProcessFactory; use Infection\Process\OriginalPhpProcess; use const PHP_OS_FAMILY; @@ -87,7 +86,6 @@ public function test_it_creates_a_process_with_coverage_skipped(): void $this->assertNull($process->getTimeout()); $this->assertNotInstanceOf(OriginalPhpProcess::class, $process); - $this->assertInstanceOf(CoveredPhpProcess::class, $process); } public function test_it_creates_a_process_with_coverage(): void From 51f3d8f734e3cb844fd78e5b175925a18031ab7a Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:49:05 +0900 Subject: [PATCH 24/38] Also check for PCOV and PHPDBG --- src/Process/OriginalPhpProcess.php | 4 ++++ tests/phpunit/Process/OriginalPhpProcessTest.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index 475d7eee8..0d549bc32 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -38,7 +38,9 @@ use function array_merge; use Composer\XdebugHandler\PhpConfig; use Composer\XdebugHandler\XdebugHandler; +use function extension_loaded; use function ini_get as ini_get_unsafe; +use const PHP_SAPI; use Symfony\Component\Process\Process; /** @@ -61,6 +63,8 @@ public function start(?callable $callback = null, ?array $env = null): void $phpConfig->useOriginal(); if ( + extension_loaded('pcov') || + PHP_SAPI === 'phpdbg' || XdebugHandler::getSkippedVersion() !== '' || // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have // it too, but it has coverage enabled at all times. diff --git a/tests/phpunit/Process/OriginalPhpProcessTest.php b/tests/phpunit/Process/OriginalPhpProcessTest.php index b0a860dda..7905e2c24 100644 --- a/tests/phpunit/Process/OriginalPhpProcessTest.php +++ b/tests/phpunit/Process/OriginalPhpProcessTest.php @@ -36,8 +36,10 @@ namespace Infection\Tests\Process; use Composer\XdebugHandler\XdebugHandler; +use function extension_loaded; use Infection\Process\OriginalPhpProcess; use function ini_get as ini_get_unsafe; +use const PHP_SAPI; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; @@ -64,7 +66,12 @@ public function test_it_injects_xdebug_env_vars(): void $process = new OriginalPhpProcess(['env']); $process->run(null, ['TESTING' => 'test']); - if (XdebugHandler::getSkippedVersion() !== '' || ini_get_unsafe('xdebug.mode') !== false) { + if ( + extension_loaded('pcov') || + PHP_SAPI === 'phpdbg' || + XdebugHandler::getSkippedVersion() !== '' || + ini_get_unsafe('xdebug.mode') !== false + ) { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { $this->assertStringNotContainsString('XDEBUG_MODE=coverage', $process->getOutput()); From ba71b3bedcebd951b3d971442e077a66bca73a0a Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:54:42 +0900 Subject: [PATCH 25/38] composer.lock: update deps --- composer.lock | 225 ++++++++++++++++++++++++++------------------------ 1 file changed, 115 insertions(+), 110 deletions(-) diff --git a/composer.lock b/composer.lock index 3c5545855..2e0a90d33 100644 --- a/composer.lock +++ b/composer.lock @@ -8,21 +8,21 @@ "packages": [ { "name": "composer/xdebug-handler", - "version": "2.0.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5" + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/31d57697eb1971712a08031cfaff5a846d10bdf5", - "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { "phpstan/phpstan": "^0.12.55", @@ -52,7 +52,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.0" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" }, "funding": [ { @@ -68,7 +68,7 @@ "type": "tidelift" } ], - "time": "2021-04-09T19:40:06+00:00" + "time": "2021-07-31T17:03:58+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -593,16 +593,16 @@ }, { "name": "sanmai/pipeline", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/sanmai/pipeline.git", - "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518" + "reference": "34232df0bd3bd27798fa5d0be1fc22e8395129cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/pipeline/zipball/f935e10ddcb758c89829e7b69cfb1dc2b2638518", - "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/34232df0bd3bd27798fa5d0be1fc22e8395129cf", + "reference": "34232df0bd3bd27798fa5d0be1fc22e8395129cf", "shasum": "" }, "require": { @@ -610,14 +610,14 @@ }, "require-dev": { "ergebnis/composer-normalize": "^2.8", - "friendsofphp/php-cs-fixer": "^2.16", + "friendsofphp/php-cs-fixer": "^3", "infection/infection": ">=0.10.5", "league/pipeline": "^1.0 || ^0.3", - "phan/phan": "^1.1 || ^2.0 || ^3.0", + "phan/phan": ">=1.1", "php-coveralls/php-coveralls": "^2.4.1", "phpstan/phpstan": ">=0.10", "phpunit/phpunit": "^7.4 || ^8.1 || ^9.4", - "vimeo/psalm": "^2.0 || ^3.0 || ^4.0" + "vimeo/psalm": ">=2" }, "type": "library", "extra": { @@ -646,7 +646,7 @@ "description": "General-purpose collections pipeline", "support": { "issues": "https://github.com/sanmai/pipeline/issues", - "source": "https://github.com/sanmai/pipeline/tree/v5.1.0" + "source": "https://github.com/sanmai/pipeline/tree/v5.2.0" }, "funding": [ { @@ -654,7 +654,7 @@ "type": "github" } ], - "time": "2020-10-25T15:20:56+00:00" + "time": "2021-10-10T13:44:01+00:00" }, { "name": "sebastian/diff", @@ -1927,30 +1927,35 @@ }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1974,9 +1979,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" }, { "name": "webmozart/path-util", @@ -2032,16 +2037,16 @@ "packages-dev": [ { "name": "brianium/paratest", - "version": "v6.3.0", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e" + "reference": "3d81e35876f6497467310b123583cca6bd4c38f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/268d5b2b4237c0abf76c4aa9633ad8580be01e1e", - "reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/3d81e35876f6497467310b123583cca6bd4c38f2", + "reference": "3d81e35876f6497467310b123583cca6bd4c38f2", "shasum": "" }, "require": { @@ -2053,25 +2058,25 @@ "phpunit/php-code-coverage": "^9.2.6", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-timer": "^5.0.3", - "phpunit/phpunit": "^9.5.4", + "phpunit/phpunit": "^9.5.8", "sebastian/environment": "^5.1.3", - "symfony/console": "^4.4.21 || ^5.2.6", - "symfony/process": "^4.4.21 || ^5.2.4" + "symfony/console": "^4.4.23 || ^5.3.6", + "symfony/process": "^4.4.22 || ^5.3.4" }, "require-dev": { "doctrine/coding-standard": "^9.0.0", "ekino/phpstan-banned-code": "^0.4.0", "ergebnis/phpstan-rules": "^0.15.3", "ext-posix": "*", - "infection/infection": "^0.21.5", - "phpstan/phpstan": "^0.12.84", + "infection/infection": "^0.24", + "phpstan/phpstan": "^0.12.94", "phpstan/phpstan-deprecation-rules": "^0.12.6", - "phpstan/phpstan-phpunit": "^0.12.18", - "phpstan/phpstan-strict-rules": "^0.12.9", + "phpstan/phpstan-phpunit": "^0.12.21", + "phpstan/phpstan-strict-rules": "^0.12.10", "squizlabs/php_codesniffer": "^3.6.0", - "symfony/filesystem": "^5.2.6", + "symfony/filesystem": "^5.3.4", "thecodingmachine/phpstan-strict-rules": "^0.12.1", - "vimeo/psalm": "^4.7.1" + "vimeo/psalm": "^4.9.2" }, "bin": [ "bin/paratest" @@ -2110,7 +2115,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.3.0" + "source": "https://github.com/paratestphp/paratest/tree/v6.3.1" }, "funding": [ { @@ -2122,7 +2127,7 @@ "type": "paypal" } ], - "time": "2021-04-27T09:24:27+00:00" + "time": "2021-08-10T07:38:58+00:00" }, { "name": "doctrine/instantiator", @@ -2195,16 +2200,16 @@ }, { "name": "helmich/phpunit-json-assert", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/martin-helmich/phpunit-json-assert.git", - "reference": "87cdc17047e50a2fa165422a14f1d6355c1d939b" + "reference": "e2ff61f042c6c86566db297f7da13538bfb80140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/martin-helmich/phpunit-json-assert/zipball/87cdc17047e50a2fa165422a14f1d6355c1d939b", - "reference": "87cdc17047e50a2fa165422a14f1d6355c1d939b", + "url": "https://api.github.com/repos/martin-helmich/phpunit-json-assert/zipball/e2ff61f042c6c86566db297f7da13538bfb80140", + "reference": "e2ff61f042c6c86566db297f7da13538bfb80140", "shasum": "" }, "require": { @@ -2237,7 +2242,7 @@ "description": "PHPUnit assertions for JSON documents", "support": { "issues": "https://github.com/martin-helmich/phpunit-json-assert/issues", - "source": "https://github.com/martin-helmich/phpunit-json-assert/tree/v3.4.1" + "source": "https://github.com/martin-helmich/phpunit-json-assert/tree/v3.4.2" }, "funding": [ { @@ -2249,7 +2254,7 @@ "type": "github" } ], - "time": "2020-12-22T10:07:04+00:00" + "time": "2021-03-29T06:47:09+00:00" }, { "name": "myclabs/deep-copy", @@ -2311,16 +2316,16 @@ }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -2365,22 +2370,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { @@ -2416,9 +2421,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.1.0" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2531,16 +2536,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -2548,7 +2553,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -2574,39 +2580,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -2641,9 +2647,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpspec/prophecy-phpunit", @@ -2964,23 +2970,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.12.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3029,7 +3035,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" }, "funding": [ { @@ -3037,7 +3043,7 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2021-09-17T05:39:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3282,16 +3288,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.4", + "version": "9.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741" + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", "shasum": "" }, "require": { @@ -3303,11 +3309,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.7", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -3321,7 +3327,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -3369,7 +3375,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" }, "funding": [ { @@ -3381,7 +3387,7 @@ "type": "github" } ], - "time": "2021-03-23T07:16:29+00:00" + "time": "2021-09-25T07:38:51+00:00" }, { "name": "sebastian/cli-parser", @@ -3823,16 +3829,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { @@ -3875,7 +3881,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" }, "funding": [ { @@ -3883,7 +3889,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2021-06-11T13:31:12+00:00" }, { "name": "sebastian/lines-of-code", @@ -4170,20 +4176,21 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -4218,7 +4225,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -4226,7 +4233,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -4283,25 +4290,22 @@ }, { "name": "softcreatr/jsonpath", - "version": "0.7.2", + "version": "0.7.5", "source": { "type": "git", "url": "https://github.com/SoftCreatR/JSONPath.git", - "reference": "46689608586a8081be399342755c36e179f3b5fc" + "reference": "008569bf80aa3584834f7890781576bc7b65afa7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SoftCreatR/JSONPath/zipball/46689608586a8081be399342755c36e179f3b5fc", - "reference": "46689608586a8081be399342755c36e179f3b5fc", + "url": "https://api.github.com/repos/SoftCreatR/JSONPath/zipball/008569bf80aa3584834f7890781576bc7b65afa7", + "reference": "008569bf80aa3584834f7890781576bc7b65afa7", "shasum": "" }, "require": { "ext-json": "*", "php": ">=7.1" }, - "conflict": { - "phpunit/phpunit": "<7.0 || >= 10.0" - }, "replace": { "flow/jsonpath": "*" }, @@ -4337,6 +4341,7 @@ "description": "JSONPath implementation for parsing, searching and flattening arrays", "support": { "email": "hello@1-2.dev", + "forum": "https://github.com/SoftCreatR/JSONPath/discussions", "issues": "https://github.com/SoftCreatR/JSONPath/issues", "source": "https://github.com/SoftCreatR/JSONPath" }, @@ -4346,7 +4351,7 @@ "type": "github" } ], - "time": "2020-10-27T11:37:08+00:00" + "time": "2021-06-02T22:15:26+00:00" }, { "name": "symfony/phpunit-bridge", From b59fe4f576279cab1b9bec6a183ad7e9d38d651f Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 18:56:15 +0900 Subject: [PATCH 26/38] Actually, undo the update --- composer.lock | 225 ++++++++++++++++++++++++-------------------------- 1 file changed, 110 insertions(+), 115 deletions(-) diff --git a/composer.lock b/composer.lock index 2e0a90d33..3c5545855 100644 --- a/composer.lock +++ b/composer.lock @@ -8,21 +8,21 @@ "packages": [ { "name": "composer/xdebug-handler", - "version": "2.0.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" + "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/31d57697eb1971712a08031cfaff5a846d10bdf5", + "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1 || ^2 || ^3" + "psr/log": "^1.0" }, "require-dev": { "phpstan/phpstan": "^0.12.55", @@ -52,7 +52,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.0" }, "funding": [ { @@ -68,7 +68,7 @@ "type": "tidelift" } ], - "time": "2021-07-31T17:03:58+00:00" + "time": "2021-04-09T19:40:06+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -593,16 +593,16 @@ }, { "name": "sanmai/pipeline", - "version": "v5.2.0", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/sanmai/pipeline.git", - "reference": "34232df0bd3bd27798fa5d0be1fc22e8395129cf" + "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/pipeline/zipball/34232df0bd3bd27798fa5d0be1fc22e8395129cf", - "reference": "34232df0bd3bd27798fa5d0be1fc22e8395129cf", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/f935e10ddcb758c89829e7b69cfb1dc2b2638518", + "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518", "shasum": "" }, "require": { @@ -610,14 +610,14 @@ }, "require-dev": { "ergebnis/composer-normalize": "^2.8", - "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/php-cs-fixer": "^2.16", "infection/infection": ">=0.10.5", "league/pipeline": "^1.0 || ^0.3", - "phan/phan": ">=1.1", + "phan/phan": "^1.1 || ^2.0 || ^3.0", "php-coveralls/php-coveralls": "^2.4.1", "phpstan/phpstan": ">=0.10", "phpunit/phpunit": "^7.4 || ^8.1 || ^9.4", - "vimeo/psalm": ">=2" + "vimeo/psalm": "^2.0 || ^3.0 || ^4.0" }, "type": "library", "extra": { @@ -646,7 +646,7 @@ "description": "General-purpose collections pipeline", "support": { "issues": "https://github.com/sanmai/pipeline/issues", - "source": "https://github.com/sanmai/pipeline/tree/v5.2.0" + "source": "https://github.com/sanmai/pipeline/tree/v5.1.0" }, "funding": [ { @@ -654,7 +654,7 @@ "type": "github" } ], - "time": "2021-10-10T13:44:01+00:00" + "time": "2020-10-25T15:20:56+00:00" }, { "name": "sebastian/diff", @@ -1927,35 +1927,30 @@ }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^8.5.13" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1979,9 +1974,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2020-07-08T17:02:28+00:00" }, { "name": "webmozart/path-util", @@ -2037,16 +2032,16 @@ "packages-dev": [ { "name": "brianium/paratest", - "version": "v6.3.1", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "3d81e35876f6497467310b123583cca6bd4c38f2" + "reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/3d81e35876f6497467310b123583cca6bd4c38f2", - "reference": "3d81e35876f6497467310b123583cca6bd4c38f2", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/268d5b2b4237c0abf76c4aa9633ad8580be01e1e", + "reference": "268d5b2b4237c0abf76c4aa9633ad8580be01e1e", "shasum": "" }, "require": { @@ -2058,25 +2053,25 @@ "phpunit/php-code-coverage": "^9.2.6", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-timer": "^5.0.3", - "phpunit/phpunit": "^9.5.8", + "phpunit/phpunit": "^9.5.4", "sebastian/environment": "^5.1.3", - "symfony/console": "^4.4.23 || ^5.3.6", - "symfony/process": "^4.4.22 || ^5.3.4" + "symfony/console": "^4.4.21 || ^5.2.6", + "symfony/process": "^4.4.21 || ^5.2.4" }, "require-dev": { "doctrine/coding-standard": "^9.0.0", "ekino/phpstan-banned-code": "^0.4.0", "ergebnis/phpstan-rules": "^0.15.3", "ext-posix": "*", - "infection/infection": "^0.24", - "phpstan/phpstan": "^0.12.94", + "infection/infection": "^0.21.5", + "phpstan/phpstan": "^0.12.84", "phpstan/phpstan-deprecation-rules": "^0.12.6", - "phpstan/phpstan-phpunit": "^0.12.21", - "phpstan/phpstan-strict-rules": "^0.12.10", + "phpstan/phpstan-phpunit": "^0.12.18", + "phpstan/phpstan-strict-rules": "^0.12.9", "squizlabs/php_codesniffer": "^3.6.0", - "symfony/filesystem": "^5.3.4", + "symfony/filesystem": "^5.2.6", "thecodingmachine/phpstan-strict-rules": "^0.12.1", - "vimeo/psalm": "^4.9.2" + "vimeo/psalm": "^4.7.1" }, "bin": [ "bin/paratest" @@ -2115,7 +2110,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.3.1" + "source": "https://github.com/paratestphp/paratest/tree/v6.3.0" }, "funding": [ { @@ -2127,7 +2122,7 @@ "type": "paypal" } ], - "time": "2021-08-10T07:38:58+00:00" + "time": "2021-04-27T09:24:27+00:00" }, { "name": "doctrine/instantiator", @@ -2200,16 +2195,16 @@ }, { "name": "helmich/phpunit-json-assert", - "version": "v3.4.2", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/martin-helmich/phpunit-json-assert.git", - "reference": "e2ff61f042c6c86566db297f7da13538bfb80140" + "reference": "87cdc17047e50a2fa165422a14f1d6355c1d939b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/martin-helmich/phpunit-json-assert/zipball/e2ff61f042c6c86566db297f7da13538bfb80140", - "reference": "e2ff61f042c6c86566db297f7da13538bfb80140", + "url": "https://api.github.com/repos/martin-helmich/phpunit-json-assert/zipball/87cdc17047e50a2fa165422a14f1d6355c1d939b", + "reference": "87cdc17047e50a2fa165422a14f1d6355c1d939b", "shasum": "" }, "require": { @@ -2242,7 +2237,7 @@ "description": "PHPUnit assertions for JSON documents", "support": { "issues": "https://github.com/martin-helmich/phpunit-json-assert/issues", - "source": "https://github.com/martin-helmich/phpunit-json-assert/tree/v3.4.2" + "source": "https://github.com/martin-helmich/phpunit-json-assert/tree/v3.4.1" }, "funding": [ { @@ -2254,7 +2249,7 @@ "type": "github" } ], - "time": "2021-03-29T06:47:09+00:00" + "time": "2020-12-22T10:07:04+00:00" }, { "name": "myclabs/deep-copy", @@ -2316,16 +2311,16 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { @@ -2370,22 +2365,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/master" }, - "time": "2021-07-20T11:28:43+00:00" + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { @@ -2421,9 +2416,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.0.4" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2020-12-13T23:18:30+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2536,16 +2531,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -2553,8 +2548,7 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "ext-tokenizer": "*" }, "type": "library", "extra": { @@ -2580,39 +2574,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", + "php": "^7.2 || ~8.0, <8.1", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", + "phpspec/phpspec": "^6.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { @@ -2647,9 +2641,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2020-12-19T10:15:11+00:00" }, { "name": "phpspec/prophecy-phpunit", @@ -2970,23 +2964,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "f6293e1b30a2354e8428e004689671b83871edde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", + "reference": "f6293e1b30a2354e8428e004689671b83871edde", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.10.2", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3035,7 +3029,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" }, "funding": [ { @@ -3043,7 +3037,7 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2021-03-28T07:26:59+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3288,16 +3282,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "c73c6737305e779771147af66c96ca6a7ed8a741" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741", + "reference": "c73c6737305e779771147af66c96ca6a7ed8a741", "shasum": "" }, "require": { @@ -3309,11 +3303,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", + "phar-io/manifest": "^2.0.1", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.3", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -3327,7 +3321,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^2.3", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -3375,7 +3369,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4" }, "funding": [ { @@ -3387,7 +3381,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2021-03-23T07:16:29+00:00" }, { "name": "sebastian/cli-parser", @@ -3829,16 +3823,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", "shasum": "" }, "require": { @@ -3881,7 +3875,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" }, "funding": [ { @@ -3889,7 +3883,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2020-10-26T15:55:19+00:00" }, { "name": "sebastian/lines-of-code", @@ -4176,21 +4170,20 @@ "type": "github" } ], - "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", "shasum": "" }, "require": { @@ -4225,7 +4218,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" }, "funding": [ { @@ -4233,7 +4226,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2020-10-26T13:18:59+00:00" }, { "name": "sebastian/version", @@ -4290,22 +4283,25 @@ }, { "name": "softcreatr/jsonpath", - "version": "0.7.5", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/SoftCreatR/JSONPath.git", - "reference": "008569bf80aa3584834f7890781576bc7b65afa7" + "reference": "46689608586a8081be399342755c36e179f3b5fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SoftCreatR/JSONPath/zipball/008569bf80aa3584834f7890781576bc7b65afa7", - "reference": "008569bf80aa3584834f7890781576bc7b65afa7", + "url": "https://api.github.com/repos/SoftCreatR/JSONPath/zipball/46689608586a8081be399342755c36e179f3b5fc", + "reference": "46689608586a8081be399342755c36e179f3b5fc", "shasum": "" }, "require": { "ext-json": "*", "php": ">=7.1" }, + "conflict": { + "phpunit/phpunit": "<7.0 || >= 10.0" + }, "replace": { "flow/jsonpath": "*" }, @@ -4341,7 +4337,6 @@ "description": "JSONPath implementation for parsing, searching and flattening arrays", "support": { "email": "hello@1-2.dev", - "forum": "https://github.com/SoftCreatR/JSONPath/discussions", "issues": "https://github.com/SoftCreatR/JSONPath/issues", "source": "https://github.com/SoftCreatR/JSONPath" }, @@ -4351,7 +4346,7 @@ "type": "github" } ], - "time": "2021-06-02T22:15:26+00:00" + "time": "2020-10-27T11:37:08+00:00" }, { "name": "symfony/phpunit-bridge", From 2d9435e3a0bb4cb5de7a5c38a65b2c0ad1eb7b8e Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 19:08:40 +0900 Subject: [PATCH 27/38] No quotes required here apparently --- tests/phpunit/Console/E2ETest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/Console/E2ETest.php b/tests/phpunit/Console/E2ETest.php index 71179698d..61147fde2 100644 --- a/tests/phpunit/Console/E2ETest.php +++ b/tests/phpunit/Console/E2ETest.php @@ -145,7 +145,7 @@ public function test_it_runs_on_itself(): void } $output = $this->runInfection(self::EXPECT_SUCCESS, [ - '--test-framework-options="--exclude-group=' . self::EXCLUDED_GROUP . '"', + '--test-framework-options=--exclude-group=' . self::EXCLUDED_GROUP, ]); $this->assertMatchesRegularExpression('/\d+ mutations were generated/', $output); From 2b6b4d00f87006de61ece0900aaa51f6698ce006 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 19:31:59 +0900 Subject: [PATCH 28/38] Fix e2e tests collecting coverage outside of Infection --- tests/e2e/Exec_Path/run_tests.bash | 1 + tests/e2e/Provide_Existing_Coverage/run_tests.bash | 1 + tests/e2e/Skip_Initial_Tests/run_tests.bash | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/e2e/Exec_Path/run_tests.bash b/tests/e2e/Exec_Path/run_tests.bash index 6d3ad8355..9524dc1d8 100755 --- a/tests/e2e/Exec_Path/run_tests.bash +++ b/tests/e2e/Exec_Path/run_tests.bash @@ -35,6 +35,7 @@ if [ "$DRIVER" = "phpdbg" ] then PATH=$PATH:bin phpdbg -qrr vendor/bin/phpunit --coverage-xml=coverage/coverage-xml --log-junit=coverage/junit.xml else + export XDEBUG_MODE=coverage PATH=$PATH:bin php vendor/bin/phpunit --coverage-xml=coverage/coverage-xml --log-junit=coverage/junit.xml fi diff --git a/tests/e2e/Provide_Existing_Coverage/run_tests.bash b/tests/e2e/Provide_Existing_Coverage/run_tests.bash index 44679065f..f7404a00e 100755 --- a/tests/e2e/Provide_Existing_Coverage/run_tests.bash +++ b/tests/e2e/Provide_Existing_Coverage/run_tests.bash @@ -4,6 +4,7 @@ set -e pipefail readonly INFECTION="../../../bin/infection --coverage=infection-coverage" readonly PHPUNIT="vendor/bin/phpunit --coverage-xml=infection-coverage/coverage-xml --log-junit=infection-coverage/junit.xml" +export XDEBUG_MODE=coverage if [ "$DRIVER" = "phpdbg" ] then diff --git a/tests/e2e/Skip_Initial_Tests/run_tests.bash b/tests/e2e/Skip_Initial_Tests/run_tests.bash index 035817778..f86032e24 100755 --- a/tests/e2e/Skip_Initial_Tests/run_tests.bash +++ b/tests/e2e/Skip_Initial_Tests/run_tests.bash @@ -9,6 +9,7 @@ if [ "$DRIVER" = "phpdbg" ] then phpdbg -qrr $PHPUNIT else + export XDEBUG_MODE=coverage php $PHPUNIT fi From a7c2f2f61441a16d29f9f0f9db52f081c110a379 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 19:57:19 +0900 Subject: [PATCH 29/38] Skip E2ETest if Xdebug isn't enabled --- tests/phpunit/Console/E2ETest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/phpunit/Console/E2ETest.php b/tests/phpunit/Console/E2ETest.php index 61147fde2..1e00ea329 100644 --- a/tests/phpunit/Console/E2ETest.php +++ b/tests/phpunit/Console/E2ETest.php @@ -39,6 +39,7 @@ use function basename; use Composer\Autoload\ClassLoader; use const DIRECTORY_SEPARATOR; +use ErrorException; use function extension_loaded; use function file_exists; use function function_exists; @@ -331,6 +332,14 @@ private function runInfection(int $expectedExitCode, array $argvExtra = []): str $this->markTestSkipped("Infection from within PHPUnit won't run without Xdebug or PHPDBG"); } + try { + if (extension_loaded('xdebug') && ini_get('xdebug.mode') === '') { + $this->markTestSkipped("Infection from within PHPUnit won't run without exabled Xdebug"); + } + } catch (ErrorException $e) { + // Xdebug 2 + } + /* * @see https://github.com/sebastianbergmann/php-code-coverage/blob/7743bbcfff2a907e9ee4a25be13d0f8ec5e73800/src/Driver/PHPDBG.php#L24 */ From 394e1dca92e5d70c2e05014680df83a8e51b22a9 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 20:02:35 +0900 Subject: [PATCH 30/38] There's something wrong on Windows --- tests/phpunit/Console/E2ETest.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/Console/E2ETest.php b/tests/phpunit/Console/E2ETest.php index 1e00ea329..393e5ac46 100644 --- a/tests/phpunit/Console/E2ETest.php +++ b/tests/phpunit/Console/E2ETest.php @@ -39,7 +39,6 @@ use function basename; use Composer\Autoload\ClassLoader; use const DIRECTORY_SEPARATOR; -use ErrorException; use function extension_loaded; use function file_exists; use function function_exists; @@ -332,12 +331,8 @@ private function runInfection(int $expectedExitCode, array $argvExtra = []): str $this->markTestSkipped("Infection from within PHPUnit won't run without Xdebug or PHPDBG"); } - try { - if (extension_loaded('xdebug') && ini_get('xdebug.mode') === '') { - $this->markTestSkipped("Infection from within PHPUnit won't run without exabled Xdebug"); - } - } catch (ErrorException $e) { - // Xdebug 2 + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test can be unstable on Windows'); } /* From 45975454337e6be0a3b7362f90a6efe605508b4a Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 20:05:47 +0900 Subject: [PATCH 31/38] Explain the why --- src/Process/OriginalPhpProcess.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index 0d549bc32..597fa645b 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -70,6 +70,9 @@ public function start(?callable $callback = null, ?array $env = null): void // it too, but it has coverage enabled at all times. ini_get_unsafe('xdebug.mode') !== false ) { + // Why going through all the trouble above? We don't want to enable + // Xdebug when there are more compelling choices. In the end the user is + // still in control: they can provide XDEBUG_MODE=coverage on their own. $env = array_merge($env ?? [], [ 'XDEBUG_MODE' => 'coverage', ]); From eec4a3321b4b1f3a28fc3ea435151b4196006db5 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sat, 16 Oct 2021 20:07:10 +0900 Subject: [PATCH 32/38] Move override close to the point of use --- tests/e2e/Provide_Existing_Coverage/run_tests.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Provide_Existing_Coverage/run_tests.bash b/tests/e2e/Provide_Existing_Coverage/run_tests.bash index f7404a00e..37394ee54 100755 --- a/tests/e2e/Provide_Existing_Coverage/run_tests.bash +++ b/tests/e2e/Provide_Existing_Coverage/run_tests.bash @@ -4,12 +4,12 @@ set -e pipefail readonly INFECTION="../../../bin/infection --coverage=infection-coverage" readonly PHPUNIT="vendor/bin/phpunit --coverage-xml=infection-coverage/coverage-xml --log-junit=infection-coverage/junit.xml" -export XDEBUG_MODE=coverage if [ "$DRIVER" = "phpdbg" ] then phpdbg -qrr $PHPUNIT else + export XDEBUG_MODE=coverage php $PHPUNIT fi From e958091824fa646da7e777679e7fd99ef3e82f05 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Mon, 18 Oct 2021 08:39:30 +0900 Subject: [PATCH 33/38] Fix negation --- src/Process/OriginalPhpProcess.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index 597fa645b..2fd514d73 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -62,9 +62,14 @@ public function start(?callable $callback = null, ?array $env = null): void $phpConfig = new PhpConfig(); $phpConfig->useOriginal(); + // We don't want to add XDEBUG_MODE=coverage if: + // - PCOV is loaded + // - PHPDBG is in use + // - Xdebug wasn't ever there + // - or Xdebug isn't version 3+ if ( - extension_loaded('pcov') || - PHP_SAPI === 'phpdbg' || + !extension_loaded('pcov') || + PHP_SAPI !== 'phpdbg' || XdebugHandler::getSkippedVersion() !== '' || // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have // it too, but it has coverage enabled at all times. From db7bd12dc651cb1fdc62f8109e5b08b2bc1a73ff Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Mon, 18 Oct 2021 08:46:42 +0900 Subject: [PATCH 34/38] Rename xdebug-coverage.ini --- devTools/Dockerfile | 2 +- devTools/{xdebug-coverage.ini => xdebug.ini} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename devTools/{xdebug-coverage.ini => xdebug.ini} (100%) diff --git a/devTools/Dockerfile b/devTools/Dockerfile index c2d44757f..c940361ef 100644 --- a/devTools/Dockerfile +++ b/devTools/Dockerfile @@ -30,7 +30,7 @@ RUN apk add --no-cache \ zip COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -COPY memory-limit.ini xdebug-coverage.ini ${PHP_INI_DIR}/conf.d/ +COPY memory-limit.ini xdebug.ini ${PHP_INI_DIR}/conf.d/ RUN adduser -h /opt/infection -s /bin/bash -D infection diff --git a/devTools/xdebug-coverage.ini b/devTools/xdebug.ini similarity index 100% rename from devTools/xdebug-coverage.ini rename to devTools/xdebug.ini From 50ee06faffd4227783efc9cdb4dc7b5cff8a9929 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 10 Nov 2021 16:40:31 +0900 Subject: [PATCH 35/38] Make it all more readable --- src/Process/OriginalPhpProcess.php | 43 +++++++++++++++++++----------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index 2fd514d73..9f42f4b0e 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -62,22 +62,7 @@ public function start(?callable $callback = null, ?array $env = null): void $phpConfig = new PhpConfig(); $phpConfig->useOriginal(); - // We don't want to add XDEBUG_MODE=coverage if: - // - PCOV is loaded - // - PHPDBG is in use - // - Xdebug wasn't ever there - // - or Xdebug isn't version 3+ - if ( - !extension_loaded('pcov') || - PHP_SAPI !== 'phpdbg' || - XdebugHandler::getSkippedVersion() !== '' || - // Any other value but false means Xdebug 3 is loaded. Xdebug 2 didn't have - // it too, but it has coverage enabled at all times. - ini_get_unsafe('xdebug.mode') !== false - ) { - // Why going through all the trouble above? We don't want to enable - // Xdebug when there are more compelling choices. In the end the user is - // still in control: they can provide XDEBUG_MODE=coverage on their own. + if (self::shallExtendEnvironmentWithXdebugMode()) { $env = array_merge($env ?? [], [ 'XDEBUG_MODE' => 'coverage', ]); @@ -87,4 +72,30 @@ public function start(?callable $callback = null, ?array $env = null): void $phpConfig->usePersistent(); } + + private static function shallExtendEnvironmentWithXdebugMode(): bool + { + // Most obvious cases when we don't want to add XDEBUG_MODE=coverage: + // - PCOV is loaded + // - PHPDBG is in use + if (extension_loaded('pcov') || PHP_SAPI === 'phpdbg') { + return false; + } + + // We also do not need to add XDEBUG_MODE for Xdebug <=3: + // it had coverage enabled at all times and it didn't have `xdebug.mode`. + if (ini_get_unsafe('xdebug.mode') === false) { + return false; + } + + // We also don't need anything if Xdebug wasn't there to begin with + if (XdebugHandler::getSkippedVersion() === '') { + return false; + } + + // Why going through all the trouble above? We don't want to enable + // Xdebug when there are more compelling choices. In the end the user is + // still in control: they can provide XDEBUG_MODE=coverage on their own. + return true; + } } From 4270a9b06bcddc128463ad90f10bfa6d8a23b9a5 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 10 Nov 2021 16:43:28 +0900 Subject: [PATCH 36/38] Patch up to master --- devTools/phpstan-src.neon | 3 --- 1 file changed, 3 deletions(-) diff --git a/devTools/phpstan-src.neon b/devTools/phpstan-src.neon index d9e5bc115..7a709b716 100644 --- a/devTools/phpstan-src.neon +++ b/devTools/phpstan-src.neon @@ -28,9 +28,6 @@ parameters: path: '../src/Container.php' message: '#^Method Infection\\Container::get.*\(\) should return .* but returns object\.$#' count: 1 - - - path: '../src/FileSystem/DummyFileSystem.php' - message: '#Infection\\FileSystem\\DummyFileSystem#' - path: '../src/Process/OriginalPhpProcess.php' message: '#Function ini_get is unsafe to use#' From 2b8a3245582be98a17c6d43a52c422d62be17a84 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 10 Nov 2021 16:48:26 +0900 Subject: [PATCH 37/38] Fix tests --- tests/phpunit/Process/OriginalPhpProcessTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/Process/OriginalPhpProcessTest.php b/tests/phpunit/Process/OriginalPhpProcessTest.php index 7905e2c24..a99d130e1 100644 --- a/tests/phpunit/Process/OriginalPhpProcessTest.php +++ b/tests/phpunit/Process/OriginalPhpProcessTest.php @@ -35,7 +35,6 @@ namespace Infection\Tests\Process; -use Composer\XdebugHandler\XdebugHandler; use function extension_loaded; use Infection\Process\OriginalPhpProcess; use function ini_get as ini_get_unsafe; @@ -67,10 +66,9 @@ public function test_it_injects_xdebug_env_vars(): void $process->run(null, ['TESTING' => 'test']); if ( - extension_loaded('pcov') || - PHP_SAPI === 'phpdbg' || - XdebugHandler::getSkippedVersion() !== '' || - ini_get_unsafe('xdebug.mode') !== false + !extension_loaded('pcov') && + PHP_SAPI !== 'phpdbg' && + ini_get_unsafe('xdebug.mode') === false ) { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else { From 20a9b99963a2fdc01cc931beee52c0047537ff21 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 10 Nov 2021 17:27:38 +0900 Subject: [PATCH 38/38] Fix this --- src/Process/OriginalPhpProcess.php | 7 ++----- tests/phpunit/Process/OriginalPhpProcessTest.php | 5 ++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Process/OriginalPhpProcess.php b/src/Process/OriginalPhpProcess.php index 9f42f4b0e..09b62f855 100644 --- a/src/Process/OriginalPhpProcess.php +++ b/src/Process/OriginalPhpProcess.php @@ -88,14 +88,11 @@ private static function shallExtendEnvironmentWithXdebugMode(): bool return false; } - // We also don't need anything if Xdebug wasn't there to begin with - if (XdebugHandler::getSkippedVersion() === '') { - return false; - } + // The last case: Xdebug 3+ running inactive. + return ini_get_unsafe('xdebug.mode') === ''; // Why going through all the trouble above? We don't want to enable // Xdebug when there are more compelling choices. In the end the user is // still in control: they can provide XDEBUG_MODE=coverage on their own. - return true; } } diff --git a/tests/phpunit/Process/OriginalPhpProcessTest.php b/tests/phpunit/Process/OriginalPhpProcessTest.php index a99d130e1..6a7077e5c 100644 --- a/tests/phpunit/Process/OriginalPhpProcessTest.php +++ b/tests/phpunit/Process/OriginalPhpProcessTest.php @@ -68,7 +68,10 @@ public function test_it_injects_xdebug_env_vars(): void if ( !extension_loaded('pcov') && PHP_SAPI !== 'phpdbg' && - ini_get_unsafe('xdebug.mode') === false + ( + ini_get_unsafe('xdebug.mode') === false || + ini_get_unsafe('xdebug.mode') === '' + ) ) { $this->assertStringContainsString('XDEBUG_MODE=coverage', $process->getOutput()); } else {