From 7ee97e2ef0588bd9a2547339c1d21331ffd5e5fa Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 11 Feb 2020 23:41:45 +0100 Subject: [PATCH] cs-fix --- lib/Context/Internal/Runner/WebRunner.php | 9 ++++----- lib/Context/Internal/Runner/process-runner.php | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/Context/Internal/Runner/WebRunner.php b/lib/Context/Internal/Runner/WebRunner.php index d7f0b7e..c00133e 100644 --- a/lib/Context/Internal/Runner/WebRunner.php +++ b/lib/Context/Internal/Runner/WebRunner.php @@ -5,7 +5,6 @@ namespace Amp\Parallel\Context\Internal\Runner; use Amp\ByteStream\ResourceOutputStream; use Amp\Parallel\Context\ContextException; use Amp\Parallel\Context\Internal\ProcessHub; -use Amp\Parallel\Context\Internal\Runner\RunnerAbstract; use Amp\Promise; use Amp\Success; @@ -33,7 +32,7 @@ final class WebRunner extends RunnerAbstract private $running = false; /** - * Socket + * Socket. * * @var ResourceOutputStream */ @@ -59,7 +58,7 @@ final class WebRunner extends RunnerAbstract if (\substr($uri, -1) === '/') { // http://example.com/path/ (assumed index.php) $uri .= 'index'; // Add fake file name } - $uri = str_replace('//', '/', $uri); + $uri = \str_replace('//', '/', $uri); $rootDir = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $rootDir = \end($rootDir)['file'] ?? ''; @@ -106,7 +105,7 @@ final class WebRunner extends RunnerAbstract if (!\is_array($script)) { $script = [$script]; } - array_unshift($script, $hub->getUri()); + \array_unshift($script, $hub->getUri()); $this->params = [ 'cwd' => $cwd, 'env' => $env, @@ -151,7 +150,7 @@ final class WebRunner extends RunnerAbstract // We don't care for results or timeouts here, PHP doesn't count IOwait time as execution time anyway // Technically should use amphp/socket, but I guess it's OK to not introduce another dependency just for a socket that will be used once. - $this->res = new ResourceOutputStream(\fsockopen($address, $port)); + $this->res = new ResourceOutputStream(\fsockopen($address, $port)); $this->running = true; return $this->res->write($payload); } diff --git a/lib/Context/Internal/Runner/process-runner.php b/lib/Context/Internal/Runner/process-runner.php index 809c479..6e9f418 100644 --- a/lib/Context/Internal/Runner/process-runner.php +++ b/lib/Context/Internal/Runner/process-runner.php @@ -39,8 +39,8 @@ if (\function_exists("cli_set_process_title")) { $fromWeb = false; if (!isset($argv)) { // Running from web $argv = $_REQUEST['argv'] ?? []; - array_unshift($argv, __DIR__); - $argc = count($argv); + \array_unshift($argv, __DIR__); + $argc = \count($argv); $fromWeb = true; @\ini_set('html_errors', 0); @@ -135,9 +135,9 @@ if (!isset($argv)) { // Running from web if ($fromWeb) { // Set environment variables only after auth if (isset($_REQUEST['cwd'])) { - chdir($_REQUEST['cwd']); + \chdir($_REQUEST['cwd']); } - if (isset($_REQUEST['env']) && is_array($_REQUEST['env'])) { + if (isset($_REQUEST['env']) && \is_array($_REQUEST['env'])) { foreach ($_REQUEST['env'] as $key => $value) { @\putenv("$key=$value"); }