Skip to content

Commit 8489340

Browse files
committed
Refactor ProcessRunner
1 parent 85b4d8d commit 8489340

6 files changed

Lines changed: 12 additions & 25 deletions

File tree

src/Deployer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
use Deployer\Component\PharUpdate\Console\Command as PharUpdateCommand;
2323
use Deployer\Component\PharUpdate\Console\Helper as PharUpdateHelper;
2424
use Deployer\Component\Pimple\Container;
25-
use Deployer\Component\ProcessRunner\Printer;
26-
use Deployer\Component\ProcessRunner\ProcessRunner;
25+
use Deployer\ProcessRunner\Printer;
26+
use Deployer\ProcessRunner\ProcessRunner;
2727
use Deployer\Ssh\SshClient;
2828
use Deployer\Configuration\Configuration;
2929
use Deployer\Executor\Master;

src/Logger/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Deployer\Logger;
1212

13-
use Deployer\Component\ProcessRunner\Printer;
13+
use Deployer\ProcessRunner\Printer;
1414
use Deployer\Host\Host;
1515
use Deployer\Logger\Handler\HandlerInterface;
1616

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace Deployer\Component\ProcessRunner;
11+
namespace Deployer\ProcessRunner;
1212

1313
use Deployer\Host\Host;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515

1616
class Printer
1717
{
18-
/**
19-
* @var OutputInterface
20-
*/
21-
private $output;
18+
private OutputInterface $output;
2219

2320
public function __construct(OutputInterface $output)
2421
{

src/Component/ProcessRunner/ProcessRunner.php renamed to src/ProcessRunner/ProcessRunner.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,28 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace Deployer\Component\ProcessRunner;
11+
namespace Deployer\ProcessRunner;
1212

1313
use Deployer\Exception\RunException;
1414
use Deployer\Exception\TimeoutException;
1515
use Deployer\Host\Host;
1616
use Deployer\Logger\Logger;
17+
use Deployer\ProcessRunner\Printer;
1718
use Symfony\Component\Process\Exception\ProcessFailedException;
1819
use Symfony\Component\Process\Exception\ProcessTimedOutException;
1920
use Symfony\Component\Process\Process;
2021

2122
class ProcessRunner
2223
{
23-
/**
24-
* @var Printer
25-
*/
26-
private $pop;
27-
/**
28-
* @var Logger
29-
*/
30-
private $logger;
24+
private Printer $pop;
25+
private Logger $logger;
3126

3227
public function __construct(Printer $pop, Logger $logger)
3328
{
3429
$this->pop = $pop;
3530
$this->logger = $logger;
3631
}
3732

38-
/**
39-
* Runs a command, consider deployer global configs (timeout,...)
40-
*
41-
* @throws RunException
42-
*/
4333
public function run(Host $host, string $command, array $config = []): string
4434
{
4535
$defaults = [
@@ -82,7 +72,7 @@ public function run(Host $host, string $command, array $config = []): string
8272
$process->getOutput(),
8373
$process->getErrorOutput(),
8474
);
85-
} catch (ProcessTimedOutException $exception) { // @phpstan-ignore-line can be thrown but is absent from the phpdoc
75+
} catch (ProcessTimedOutException $exception) {
8676
throw new TimeoutException(
8777
$command,
8878
$exception->getExceededTimeout(),

src/Ssh/SshClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Deployer\Ssh;
1212

13-
use Deployer\Component\ProcessRunner\Printer;
13+
use Deployer\ProcessRunner\Printer;
1414
use Deployer\Exception\RunException;
1515
use Deployer\Exception\TimeoutException;
1616
use Deployer\Host\Host;

src/Utility/Rsync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Deployer\Utility;
1212

13-
use Deployer\Component\ProcessRunner\Printer;
13+
use Deployer\ProcessRunner\Printer;
1414
use Deployer\Exception\RunException;
1515
use Deployer\Host\Host;
1616
use Symfony\Component\Console\Helper\ProgressBar;

0 commit comments

Comments
 (0)