From d49431fe6ceabc3d3d466f689b2a9464b2a0c0b5 Mon Sep 17 00:00:00 2001 From: Andor Date: Mon, 26 Dec 2022 01:27:22 +0100 Subject: [PATCH] Issue #1135 - PHP 8.2 - Fix Use of "self" in callables is deprecated --- src/Common/CommandArguments.php | 2 +- src/Task/Base/Exec.php | 2 +- tests/phpunit/Task/ExecTest.php | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/phpunit/Task/ExecTest.php diff --git a/src/Common/CommandArguments.php b/src/Common/CommandArguments.php index 276b82b08..4fc3a90f8 100644 --- a/src/Common/CommandArguments.php +++ b/src/Common/CommandArguments.php @@ -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; } diff --git a/src/Task/Base/Exec.php b/src/Task/Base/Exec.php index 5d08e3063..b13e44f57 100644 --- a/src/Task/Base/Exec.php +++ b/src/Task/Base/Exec.php @@ -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); diff --git a/tests/phpunit/Task/ExecTest.php b/tests/phpunit/Task/ExecTest.php new file mode 100644 index 000000000..cd8d958f4 --- /dev/null +++ b/tests/phpunit/Task/ExecTest.php @@ -0,0 +1,19 @@ +assertSame( + 'ls', + (new \Robo\Task\Base\Exec('ls')) + ->getCommand() + ); + } +}