Created
March 22, 2023 13:14
-
-
Save ivangrozni/3e7cf601609e9dacf6cb5ec314127660 to your computer and use it in GitHub Desktop.
inf-477-consolidation-robo-php82.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d49431fe6ceabc3d3d466f689b2a9464b2a0c0b5 Mon Sep 17 00:00:00 2001 | |
From: Andor <david-andor@kozpontiagy.hu> | |
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 @@ | |
+<?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() | |
+ ); | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment