From e9bde2d0f11f828f21acd8e142814ae0d8811b19 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 16 Dec 2017 09:57:26 +0000 Subject: [PATCH 1/3] Use laravel provided argument escaping --- src/Illuminate/Console/Application.php | 2 +- .../Console/Scheduling/CommandBuilder.php | 2 +- .../Console/Scheduling/Schedule.php | 2 +- .../Foundation/Console/ServeCommand.php | 2 +- src/Illuminate/Queue/Listener.php | 2 +- src/Illuminate/Support/Composer.php | 2 +- src/Illuminate/Support/ProcessUtils.php | 71 +++++++++++++++++++ 7 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 src/Illuminate/Support/ProcessUtils.php diff --git a/src/Illuminate/Console/Application.php b/src/Illuminate/Console/Application.php index 02602ac9dfb4..44e63240da13 100755 --- a/src/Illuminate/Console/Application.php +++ b/src/Illuminate/Console/Application.php @@ -4,7 +4,7 @@ use Closure; use Illuminate\Contracts\Events\Dispatcher; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; use Illuminate\Contracts\Container\Container; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArrayInput; diff --git a/src/Illuminate/Console/Scheduling/CommandBuilder.php b/src/Illuminate/Console/Scheduling/CommandBuilder.php index 4e37a0d7c402..df7cdf61d553 100644 --- a/src/Illuminate/Console/Scheduling/CommandBuilder.php +++ b/src/Illuminate/Console/Scheduling/CommandBuilder.php @@ -3,7 +3,7 @@ namespace Illuminate\Console\Scheduling; use Illuminate\Console\Application; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; class CommandBuilder { diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 97af80d8b504..54a928387d36 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -5,7 +5,7 @@ use Illuminate\Console\Application; use Illuminate\Container\Container; use Illuminate\Contracts\Queue\ShouldQueue; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; class Schedule { diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index add64b3ca020..92665fcd54e7 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -3,7 +3,7 @@ namespace Illuminate\Foundation\Console; use Illuminate\Console\Command; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Process\PhpExecutableFinder; diff --git a/src/Illuminate/Queue/Listener.php b/src/Illuminate/Queue/Listener.php index fef3299e9952..9b6482447422 100755 --- a/src/Illuminate/Queue/Listener.php +++ b/src/Illuminate/Queue/Listener.php @@ -4,7 +4,7 @@ use Closure; use Symfony\Component\Process\Process; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; use Symfony\Component\Process\PhpExecutableFinder; class Listener diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index b0eaa92366ae..5200d4604832 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -4,7 +4,7 @@ use Illuminate\Filesystem\Filesystem; use Symfony\Component\Process\Process; -use Symfony\Component\Process\ProcessUtils; +use Illuminate\Support\ProcessUtils; use Symfony\Component\Process\PhpExecutableFinder; class Composer diff --git a/src/Illuminate/Support/ProcessUtils.php b/src/Illuminate/Support/ProcessUtils.php new file mode 100644 index 000000000000..d60258433f2f --- /dev/null +++ b/src/Illuminate/Support/ProcessUtils.php @@ -0,0 +1,71 @@ + Date: Sat, 16 Dec 2017 09:57:46 +0000 Subject: [PATCH 2/3] Apply fixes from StyleCI (#22447) --- src/Illuminate/Console/Application.php | 2 +- src/Illuminate/Console/Scheduling/Schedule.php | 2 +- src/Illuminate/Queue/Listener.php | 2 +- src/Illuminate/Support/Composer.php | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Console/Application.php b/src/Illuminate/Console/Application.php index 44e63240da13..c53221bf0e3e 100755 --- a/src/Illuminate/Console/Application.php +++ b/src/Illuminate/Console/Application.php @@ -3,8 +3,8 @@ namespace Illuminate\Console; use Closure; -use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\ProcessUtils; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Container\Container; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArrayInput; diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 54a928387d36..c3b602cae4ff 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -4,8 +4,8 @@ use Illuminate\Console\Application; use Illuminate\Container\Container; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Support\ProcessUtils; +use Illuminate\Contracts\Queue\ShouldQueue; class Schedule { diff --git a/src/Illuminate/Queue/Listener.php b/src/Illuminate/Queue/Listener.php index 9b6482447422..ccd62df31ab7 100755 --- a/src/Illuminate/Queue/Listener.php +++ b/src/Illuminate/Queue/Listener.php @@ -3,8 +3,8 @@ namespace Illuminate\Queue; use Closure; -use Symfony\Component\Process\Process; use Illuminate\Support\ProcessUtils; +use Symfony\Component\Process\Process; use Symfony\Component\Process\PhpExecutableFinder; class Listener diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 5200d4604832..bc76aeb24699 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -4,7 +4,6 @@ use Illuminate\Filesystem\Filesystem; use Symfony\Component\Process\Process; -use Illuminate\Support\ProcessUtils; use Symfony\Component\Process\PhpExecutableFinder; class Composer From 5f799379b3db8202ba9eb3bf57dd62dbb1622a33 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 16 Dec 2017 09:58:37 +0000 Subject: [PATCH 3/3] Fixed phpdoc --- src/Illuminate/Support/ProcessUtils.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Support/ProcessUtils.php b/src/Illuminate/Support/ProcessUtils.php index d60258433f2f..3a3b8e218967 100644 --- a/src/Illuminate/Support/ProcessUtils.php +++ b/src/Illuminate/Support/ProcessUtils.php @@ -12,8 +12,7 @@ class ProcessUtils /** * Escapes a string to be used as a shell argument. * - * @param string $argument - * + * @param string $argument * @return string */ public static function escapeArgument($argument) @@ -59,9 +58,8 @@ public static function escapeArgument($argument) /** * Is the given string surrounded by the given character? * - * @param string $arg - * @param string $char - * + * @param string $arg + * @param string $char * @return bool */ protected static function isSurroundedBy($arg, $char)