From 51e0bee9e17391727918055149f69bb1ad59ad8a Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 28 Mar 2024 10:22:55 +0100 Subject: [PATCH] Cleanup process handling after dropping temp-file handling --- src/Util/PHP/AbstractPhpProcess.php | 4 ---- src/Util/PHP/DefaultPhpProcess.php | 7 +------ src/Util/PHP/WindowsPhpProcess.php | 23 ----------------------- 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 src/Util/PHP/WindowsPhpProcess.php diff --git a/src/Util/PHP/AbstractPhpProcess.php b/src/Util/PHP/AbstractPhpProcess.php index feb0344661c..1a901099556 100644 --- a/src/Util/PHP/AbstractPhpProcess.php +++ b/src/Util/PHP/AbstractPhpProcess.php @@ -53,10 +53,6 @@ abstract class AbstractPhpProcess public static function factory(): self { - if (PHP_OS_FAMILY === 'Windows') { - return new WindowsPhpProcess; - } - return new DefaultPhpProcess; } diff --git a/src/Util/PHP/DefaultPhpProcess.php b/src/Util/PHP/DefaultPhpProcess.php index eaa05a6827a..963109dee42 100644 --- a/src/Util/PHP/DefaultPhpProcess.php +++ b/src/Util/PHP/DefaultPhpProcess.php @@ -40,7 +40,7 @@ class DefaultPhpProcess extends AbstractPhpProcess */ public function runJob(string $job, array $settings = []): array { - if ($this->stdin || $this->useTemporaryFile()) { + if ($this->stdin) { if (!($this->tempFile = tempnam(sys_get_temp_dir(), 'phpunit_')) || file_put_contents($this->tempFile, $job) === false) { throw new PhpProcessException( @@ -143,9 +143,4 @@ protected function cleanup(): void unlink($this->tempFile); } } - - protected function useTemporaryFile(): bool - { - return false; - } } diff --git a/src/Util/PHP/WindowsPhpProcess.php b/src/Util/PHP/WindowsPhpProcess.php deleted file mode 100644 index 75fa9ab909b..00000000000 --- a/src/Util/PHP/WindowsPhpProcess.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\PHP; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @see https://bugs.php.net/bug.php?id=51800 - */ -final class WindowsPhpProcess extends DefaultPhpProcess -{ - protected function useTemporaryFile(): bool - { - return false; - } -}