From ac1ba0692ad1c6b2e3b26449c687094d37a2532d Mon Sep 17 00:00:00 2001 From: Travis Carden Date: Wed, 16 Aug 2023 17:22:39 -0400 Subject: [PATCH 1/2] Fix API\Process\Service\ProcessInterface::setTimeout() taking a float instead of an int. --- src/API/Process/Service/ProcessInterface.php | 4 ++-- src/Internal/Process/Service/Process.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/API/Process/Service/ProcessInterface.php b/src/API/Process/Service/ProcessInterface.php index 19c2b7f30..1ac3200d8 100644 --- a/src/API/Process/Service/ProcessInterface.php +++ b/src/API/Process/Service/ProcessInterface.php @@ -82,12 +82,12 @@ public function setEnv(array $env): self; /** * Sets the process timeout (max. runtime) in seconds. * - * @param float|null $timeout + * @param int|null $timeout * An optional process timeout (maximum runtime) in seconds. Set to null * to disable. * * @throws \PhpTuf\ComposerStager\API\Exception\InvalidArgumentException * If the given timeout is negative. */ - public function setTimeout(?float $timeout = self::DEFAULT_TIMEOUT): self; + public function setTimeout(?int $timeout = self::DEFAULT_TIMEOUT): self; } diff --git a/src/Internal/Process/Service/Process.php b/src/Internal/Process/Service/Process.php index d2923a1ea..f8d8268a4 100644 --- a/src/Internal/Process/Service/Process.php +++ b/src/Internal/Process/Service/Process.php @@ -106,7 +106,7 @@ public function setEnv(array $env): ProcessInterface return $this; } - public function setTimeout(?float $timeout = self::DEFAULT_TIMEOUT): self + public function setTimeout(?int $timeout = self::DEFAULT_TIMEOUT): self { try { $this->symfonyProcess->setTimeout($timeout); From 3a2ffdba73cdb98dd018b6cf68df9fe1f5c72ef3 Mon Sep 17 00:00:00 2001 From: Travis Carden Date: Wed, 16 Aug 2023 20:41:26 -0400 Subject: [PATCH 2/2] Make timeout arguments non-nullable. --- src/API/Core/BeginnerInterface.php | 8 ++++---- src/API/Core/CleanerInterface.php | 8 ++++---- src/API/Core/CommitterInterface.php | 8 ++++---- src/API/Core/StagerInterface.php | 8 ++++---- src/API/FileSyncer/Service/FileSyncerInterface.php | 8 ++++---- src/API/Filesystem/Service/FilesystemInterface.php | 8 ++++---- .../Process/Service/ComposerProcessRunnerInterface.php | 8 ++++---- src/API/Process/Service/ProcessInterface.php | 8 ++++---- src/API/Process/Service/RsyncProcessRunnerInterface.php | 8 ++++---- src/Internal/Core/Beginner.php | 2 +- src/Internal/Core/Cleaner.php | 2 +- src/Internal/Core/Committer.php | 2 +- src/Internal/Core/Stager.php | 4 ++-- src/Internal/FileSyncer/Service/PhpFileSyncer.php | 4 ++-- src/Internal/FileSyncer/Service/RsyncFileSyncer.php | 4 ++-- src/Internal/Filesystem/Service/Filesystem.php | 4 ++-- src/Internal/Process/Service/AbstractProcessRunner.php | 2 +- src/Internal/Process/Service/Process.php | 2 +- tests/Core/BeginnerUnitTest.php | 4 ++-- tests/Core/CleanerUnitTest.php | 4 ++-- tests/Core/CommitterUnitTest.php | 4 ++-- tests/Core/StagerUnitTest.php | 4 ++-- tests/FileSyncer/Service/FileSyncerFunctionalTestCase.php | 4 ++-- tests/Filesystem/Service/FilesystemUnitTest.php | 2 +- tests/Process/Service/AbstractProcessRunnerUnitTest.php | 4 ++-- 25 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/API/Core/BeginnerInterface.php b/src/API/Core/BeginnerInterface.php index bc405b964..67cf30388 100644 --- a/src/API/Core/BeginnerInterface.php +++ b/src/API/Core/BeginnerInterface.php @@ -39,9 +39,9 @@ interface BeginnerInterface * as when committing. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\PreconditionException * If the preconditions are unfulfilled. @@ -55,6 +55,6 @@ public function begin( PathInterface $stagingDir, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Core/CleanerInterface.php b/src/API/Core/CleanerInterface.php index 79d4dedce..4177d79af 100644 --- a/src/API/Core/CleanerInterface.php +++ b/src/API/Core/CleanerInterface.php @@ -24,9 +24,9 @@ interface CleanerInterface * The staging directory. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\PreconditionException * If the preconditions are unfulfilled. @@ -37,6 +37,6 @@ public function clean( PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Core/CommitterInterface.php b/src/API/Core/CommitterInterface.php index 64bcad47a..b8e667e79 100644 --- a/src/API/Core/CommitterInterface.php +++ b/src/API/Core/CommitterInterface.php @@ -28,9 +28,9 @@ interface CommitterInterface * you should use the same exclusions when committing as when beginning. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\PreconditionException * If the preconditions are unfulfilled. @@ -44,6 +44,6 @@ public function commit( PathInterface $activeDir, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Core/StagerInterface.php b/src/API/Core/StagerInterface.php index ce18db2de..0729e4eca 100644 --- a/src/API/Core/StagerInterface.php +++ b/src/API/Core/StagerInterface.php @@ -35,9 +35,9 @@ interface StagerInterface * The staging directory. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\InvalidArgumentException * If the given Composer command is invalid. @@ -51,6 +51,6 @@ public function stage( PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/FileSyncer/Service/FileSyncerInterface.php b/src/API/FileSyncer/Service/FileSyncerInterface.php index c5f67f836..01e3c5e0e 100644 --- a/src/API/FileSyncer/Service/FileSyncerInterface.php +++ b/src/API/FileSyncer/Service/FileSyncerInterface.php @@ -35,9 +35,9 @@ interface FileSyncerInterface * "underneath" or "inside" it. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\IOException * If the destination directory cannot be created. @@ -49,6 +49,6 @@ public function sync( PathInterface $destination, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Filesystem/Service/FilesystemInterface.php b/src/API/Filesystem/Service/FilesystemInterface.php index 2968ceb97..6f0aad696 100644 --- a/src/API/Filesystem/Service/FilesystemInterface.php +++ b/src/API/Filesystem/Service/FilesystemInterface.php @@ -170,9 +170,9 @@ public function readLink(PathInterface $path): PathInterface; * A path to remove. * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\IOException * If the file cannot be removed. @@ -180,6 +180,6 @@ public function readLink(PathInterface $path): PathInterface; public function remove( PathInterface $path, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Process/Service/ComposerProcessRunnerInterface.php b/src/API/Process/Service/ComposerProcessRunnerInterface.php index 7c36cf586..ec4fbec33 100644 --- a/src/API/Process/Service/ComposerProcessRunnerInterface.php +++ b/src/API/Process/Service/ComposerProcessRunnerInterface.php @@ -26,9 +26,9 @@ interface ComposerProcessRunnerInterface * ``` * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\LogicException * If the command process cannot be created due to host configuration. @@ -40,6 +40,6 @@ interface ComposerProcessRunnerInterface public function run( array $command, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/API/Process/Service/ProcessInterface.php b/src/API/Process/Service/ProcessInterface.php index 1ac3200d8..2ba0c7a3e 100644 --- a/src/API/Process/Service/ProcessInterface.php +++ b/src/API/Process/Service/ProcessInterface.php @@ -82,12 +82,12 @@ public function setEnv(array $env): self; /** * Sets the process timeout (max. runtime) in seconds. * - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\InvalidArgumentException * If the given timeout is negative. */ - public function setTimeout(?int $timeout = self::DEFAULT_TIMEOUT): self; + public function setTimeout(int $timeout = self::DEFAULT_TIMEOUT): self; } diff --git a/src/API/Process/Service/RsyncProcessRunnerInterface.php b/src/API/Process/Service/RsyncProcessRunnerInterface.php index 97e86113b..632689122 100644 --- a/src/API/Process/Service/RsyncProcessRunnerInterface.php +++ b/src/API/Process/Service/RsyncProcessRunnerInterface.php @@ -26,9 +26,9 @@ interface RsyncProcessRunnerInterface * ``` * @param \PhpTuf\ComposerStager\API\Process\Service\OutputCallbackInterface|null $callback * An optional PHP callback to run whenever there is process output. - * @param int|null $timeout - * An optional process timeout (maximum runtime) in seconds. Set to null - * to disable. + * @param int $timeout + * An optional process timeout (maximum runtime) in seconds. If set to + * zero (0), no time limit is imposed. * * @throws \PhpTuf\ComposerStager\API\Exception\LogicException * If the command process cannot be created due to host configuration. @@ -40,6 +40,6 @@ interface RsyncProcessRunnerInterface public function run( array $command, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void; } diff --git a/src/Internal/Core/Beginner.php b/src/Internal/Core/Beginner.php index 03a5ab53d..23b422c11 100644 --- a/src/Internal/Core/Beginner.php +++ b/src/Internal/Core/Beginner.php @@ -30,7 +30,7 @@ public function begin( PathInterface $stagingDir, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $this->preconditions->assertIsFulfilled($activeDir, $stagingDir, $exclusions); diff --git a/src/Internal/Core/Cleaner.php b/src/Internal/Core/Cleaner.php index ebce84444..57695a087 100644 --- a/src/Internal/Core/Cleaner.php +++ b/src/Internal/Core/Cleaner.php @@ -28,7 +28,7 @@ public function clean( PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $this->preconditions->assertIsFulfilled($activeDir, $stagingDir); diff --git a/src/Internal/Core/Committer.php b/src/Internal/Core/Committer.php index 6cdff37a2..e4cbcf542 100644 --- a/src/Internal/Core/Committer.php +++ b/src/Internal/Core/Committer.php @@ -30,7 +30,7 @@ public function commit( PathInterface $activeDir, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $this->preconditions->assertIsFulfilled($activeDir, $stagingDir, $exclusions); diff --git a/src/Internal/Core/Stager.php b/src/Internal/Core/Stager.php index 1b6ec7635..54d927474 100644 --- a/src/Internal/Core/Stager.php +++ b/src/Internal/Core/Stager.php @@ -36,7 +36,7 @@ public function stage( PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $this->preconditions->assertIsFulfilled($activeDir, $stagingDir); @@ -86,7 +86,7 @@ private function runCommand( PathInterface $stagingDir, array $composerCommand, ?OutputCallbackInterface $callback, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $command = array_merge( ['--working-dir=' . $stagingDir->absolute()], diff --git a/src/Internal/FileSyncer/Service/PhpFileSyncer.php b/src/Internal/FileSyncer/Service/PhpFileSyncer.php index 914f714a1..ce5e93499 100644 --- a/src/Internal/FileSyncer/Service/PhpFileSyncer.php +++ b/src/Internal/FileSyncer/Service/PhpFileSyncer.php @@ -38,9 +38,9 @@ public function sync( PathInterface $destination, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { - set_time_limit((int) $timeout); + set_time_limit($timeout); $exclusions ??= new PathList(); diff --git a/src/Internal/FileSyncer/Service/RsyncFileSyncer.php b/src/Internal/FileSyncer/Service/RsyncFileSyncer.php index 446171bd1..fcbef576f 100644 --- a/src/Internal/FileSyncer/Service/RsyncFileSyncer.php +++ b/src/Internal/FileSyncer/Service/RsyncFileSyncer.php @@ -47,14 +47,14 @@ public function sync( PathInterface $destination, ?PathListInterface $exclusions = null, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { $sourceAbsolute = $source->absolute(); $destinationAbsolute = $destination->absolute(); $this->assertDirectoriesAreNotTheSame($source, $destination); $this->assertSourceExists($source); - set_time_limit((int) $timeout); + set_time_limit($timeout); $this->runCommand($exclusions, $sourceAbsolute, $destinationAbsolute, $destination, $callback); } diff --git a/src/Internal/Filesystem/Service/Filesystem.php b/src/Internal/Filesystem/Service/Filesystem.php index 8713b772c..f027abb72 100644 --- a/src/Internal/Filesystem/Service/Filesystem.php +++ b/src/Internal/Filesystem/Service/Filesystem.php @@ -174,12 +174,12 @@ public function readLink(PathInterface $path): PathInterface public function remove( PathInterface $path, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { try { // Symfony Filesystem doesn't have a builtin mechanism for setting a // timeout, so we have to enforce it ourselves. - set_time_limit((int) $timeout); + set_time_limit($timeout); $this->symfonyFilesystem->remove($path->absolute()); } catch (SymfonyExceptionInterface $e) { diff --git a/src/Internal/Process/Service/AbstractProcessRunner.php b/src/Internal/Process/Service/AbstractProcessRunner.php index d915371ec..31ea3cfbd 100644 --- a/src/Internal/Process/Service/AbstractProcessRunner.php +++ b/src/Internal/Process/Service/AbstractProcessRunner.php @@ -52,7 +52,7 @@ public function __construct( public function run( array $command, ?OutputCallbackInterface $callback = null, - ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT, + int $timeout = ProcessInterface::DEFAULT_TIMEOUT, ): void { array_unshift($command, $this->findExecutable()); $process = $this->processFactory->create($command); diff --git a/src/Internal/Process/Service/Process.php b/src/Internal/Process/Service/Process.php index f8d8268a4..3bc4a5311 100644 --- a/src/Internal/Process/Service/Process.php +++ b/src/Internal/Process/Service/Process.php @@ -106,7 +106,7 @@ public function setEnv(array $env): ProcessInterface return $this; } - public function setTimeout(?int $timeout = self::DEFAULT_TIMEOUT): self + public function setTimeout(int $timeout = self::DEFAULT_TIMEOUT): self { try { $this->symfonyProcess->setTimeout($timeout); diff --git a/tests/Core/BeginnerUnitTest.php b/tests/Core/BeginnerUnitTest.php index 222f25103..e406b1253 100644 --- a/tests/Core/BeginnerUnitTest.php +++ b/tests/Core/BeginnerUnitTest.php @@ -70,7 +70,7 @@ public function testBeginWithOptionalParams( string $stagingDir, ?PathListInterface $exclusions, ?OutputCallbackInterface $callback, - ?int $timeout, + int $timeout, ): void { $activeDir = new TestPath($activeDir); $stagingDir = new TestPath($stagingDir); @@ -93,7 +93,7 @@ public function providerBeginWithOptionalParams(): array 'stagingDir' => 'three/four', 'givenExclusions' => null, 'callback' => null, - 'timeout' => null, + 'timeout' => 0, ], [ 'activeDir' => 'five/six', diff --git a/tests/Core/CleanerUnitTest.php b/tests/Core/CleanerUnitTest.php index bf69a9b15..9346baeef 100644 --- a/tests/Core/CleanerUnitTest.php +++ b/tests/Core/CleanerUnitTest.php @@ -61,7 +61,7 @@ public function testCleanWithMinimumParams(): void * * @dataProvider providerCleanWithOptionalParams */ - public function testCleanWithOptionalParams(string $path, ?OutputCallbackInterface $callback, ?int $timeout): void + public function testCleanWithOptionalParams(string $path, ?OutputCallbackInterface $callback, int $timeout): void { $path = new TestPath($path); $this->preconditions @@ -81,7 +81,7 @@ public function providerCleanWithOptionalParams(): array [ 'path' => '/one/two', 'callback' => null, - 'timeout' => null, + 'timeout' => 0, ], [ 'path' => 'three/four', diff --git a/tests/Core/CommitterUnitTest.php b/tests/Core/CommitterUnitTest.php index da99eb0ce..fdb56beb8 100644 --- a/tests/Core/CommitterUnitTest.php +++ b/tests/Core/CommitterUnitTest.php @@ -70,7 +70,7 @@ public function testCommitWithOptionalParams( string $activeDir, ?PathListInterface $exclusions, ?OutputCallbackInterface $callback, - ?int $timeout, + int $timeout, ): void { $activeDir = new TestPath($activeDir); $stagingDir = new TestPath($stagingDir); @@ -93,7 +93,7 @@ public function providerCommitWithOptionalParams(): array 'activeDir' => '/three/four', 'exclusions' => null, 'callback' => null, - 'timeout' => null, + 'timeout' => 0, ], [ 'stagingDir' => 'five/six', diff --git a/tests/Core/StagerUnitTest.php b/tests/Core/StagerUnitTest.php index a0b60ef83..b5f1fb3b9 100644 --- a/tests/Core/StagerUnitTest.php +++ b/tests/Core/StagerUnitTest.php @@ -76,7 +76,7 @@ public function testStageWithOptionalParams( array $givenCommand, array $expectedCommand, ?OutputCallbackInterface $callback, - ?int $timeout, + int $timeout, ): void { $activeDirPath = PathHelper::activeDirPath(); $stagingDirPath = PathHelper::stagingDirPath(); @@ -102,7 +102,7 @@ public function providerStageWithOptionalParams(): array 'update', ], 'callback' => null, - 'timeout' => null, + 'timeout' => 0, ], [ 'givenCommand' => [self::INERT_COMMAND], diff --git a/tests/FileSyncer/Service/FileSyncerFunctionalTestCase.php b/tests/FileSyncer/Service/FileSyncerFunctionalTestCase.php index 0d67c3b44..3504cb8e5 100644 --- a/tests/FileSyncer/Service/FileSyncerFunctionalTestCase.php +++ b/tests/FileSyncer/Service/FileSyncerFunctionalTestCase.php @@ -40,7 +40,7 @@ abstract protected function fileSyncerClass(): string; * * @dataProvider providerSyncTimeout */ - public function testSyncTimeout(?int $givenTimeout, int $expectedTimeout): void + public function testSyncTimeout(int $givenTimeout, int $expectedTimeout): void { $sut = $this->createSut(); @@ -53,7 +53,7 @@ public function providerSyncTimeout(): array { return [ [ - 'givenTimeout' => null, + 'givenTimeout' => 0, 'expectedTimeout' => 0, ], [ diff --git a/tests/Filesystem/Service/FilesystemUnitTest.php b/tests/Filesystem/Service/FilesystemUnitTest.php index 1f1f987eb..09abf4711 100644 --- a/tests/Filesystem/Service/FilesystemUnitTest.php +++ b/tests/Filesystem/Service/FilesystemUnitTest.php @@ -191,7 +191,7 @@ public function providerRemove(): array [ 'path' => '/one/two', 'callback' => null, - 'givenTimeout' => null, + 'givenTimeout' => 0, 'expectedTimeout' => 0, ], [ diff --git a/tests/Process/Service/AbstractProcessRunnerUnitTest.php b/tests/Process/Service/AbstractProcessRunnerUnitTest.php index 82c4ba2da..cd8b26daf 100644 --- a/tests/Process/Service/AbstractProcessRunnerUnitTest.php +++ b/tests/Process/Service/AbstractProcessRunnerUnitTest.php @@ -84,7 +84,7 @@ public function testRun( array $givenCommand, array $expectedCommand, ?OutputCallbackInterface $callback, - ?int $timeout, + int $timeout, ): void { $this->executableFinder ->find($executableName) @@ -116,7 +116,7 @@ public function providerRun(): array 'givenCommand' => [], 'expectedCommand' => ['one'], 'callback' => null, - 'timeout' => null, + 'timeout' => 0, ], [ 'executableName' => 'two',