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 moodlehq#21 is addressed.
  • Loading branch information
kabalin committed Feb 3, 2021
1 parent 73bb1a3 commit c132719
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Process/Execute.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,37 @@ 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 mixed $helper
*/
public function setHelper(?ProcessHelper $helper)
public function setHelper($helper)
{
if (empty($helper)) {
$helper = new ProcessHelper();
Expand Down

0 comments on commit c132719

Please sign in to comment.