Skip to content

Commit

Permalink
Make php 7.0 happy with Execute constructor.
Browse files Browse the repository at this point in the history
This can be reverted when #21 is addressed.
  • Loading branch information
kabalin committed Feb 3, 2021
1 parent 73bb1a3 commit 2e429fe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Process/Execute.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,36 @@ class Execute
*/
public $parallelWaitTime = 200000;

public function __construct(?OutputInterface $output = null, ?ProcessHelper $helper = null)
/**
* TODO: Add nullable type declaration for params when we switch to php 7.1.
*
* @param OutputInterface|null $output
* @param ProcessHelper|null $helper
*/
public function __construct($output = null, $helper = null)
{
$this->setOutput($output);
$this->setHelper($helper);
}

/**
* Output setter.
* TODO: Add nullable type declaration for param when we switch to php 7.1.
*
* @param OutputInterface|null $output
*/
public function setOutput(?OutputInterface $output)
public function setOutput($output)
{
$this->output = $output ?? new NullOutput();
}

/**
* Process helper setter.
* TODO: Add nullable type declaration for param when we switch to php 7.1.
*
* @param OutputInterface|null $output
* @param ProcessHelper|null $helper
*/
public function setHelper(?ProcessHelper $helper)
public function setHelper($helper)
{
if (empty($helper)) {
$helper = new ProcessHelper();
Expand Down

0 comments on commit 2e429fe

Please sign in to comment.