Skip to content

Commit

Permalink
Issue #1135 - PHP 8.2 - Fix Use of "self" in callables is deprecated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sweetchuck authored Dec 29, 2022
1 parent e1cc641 commit a1f49b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Common/CommandArguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function args($args)
if (!is_array($args)) {
$args = $func_args;
}
$this->arguments .= ' ' . implode(' ', array_map('static::escape', $args));
$this->arguments .= ' ' . implode(' ', array_map([static::class, 'escape'], $args));
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Task/Base/Exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private function setupStopRunningJobs()
return;
}

$stopRunningJobs = Closure::fromCallable(['self', 'stopRunningJobs']);
$stopRunningJobs = Closure::fromCallable(self::class.'::stopRunningJobs');

if (function_exists('pcntl_signal')) {
pcntl_signal(SIGTERM, $stopRunningJobs);
Expand Down
19 changes: 19 additions & 0 deletions tests/phpunit/Task/ExecTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace phpunit\Task;

use PHPUnit\Framework\TestCase;

class ExecTest extends TestCase
{

// tests
public function testBasicCommand()
{
$this->assertSame(
'ls',
(new \Robo\Task\Base\Exec('ls'))
->getCommand()
);
}
}

0 comments on commit a1f49b1

Please sign in to comment.