Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / console / Helper / ProcessHelper.php
index a811eb48e6798f81feff2f0705eff6d6b4ae15bf..2c46a2c39d0b2e67f9d1d34a8d3e6cfa3790c3da 100644 (file)
@@ -36,7 +36,7 @@ class ProcessHelper extends Helper
      *
      * @return Process The process that ran
      */
-    public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
+    public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
     {
         if ($output instanceof ConsoleOutputInterface) {
             $output = $output->getErrorOutput();
@@ -92,7 +92,7 @@ class ProcessHelper extends Helper
      *
      * @see run()
      */
-    public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
+    public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
     {
         $process = $this->run($output, $cmd, $error, $callback);
 
@@ -112,7 +112,7 @@ class ProcessHelper extends Helper
      *
      * @return callable
      */
-    public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
+    public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null)
     {
         if ($output instanceof ConsoleOutputInterface) {
             $output = $output->getErrorOutput();
@@ -120,10 +120,8 @@ class ProcessHelper extends Helper
 
         $formatter = $this->getHelperSet()->get('debug_formatter');
 
-        $that = $this;
-
-        return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
-            $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
+        return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
+            $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
 
             if (null !== $callback) {
                 call_user_func($callback, $type, $buffer);
@@ -131,12 +129,7 @@ class ProcessHelper extends Helper
         };
     }
 
-    /**
-     * This method is public for PHP 5.3 compatibility, it should be private.
-     *
-     * @internal
-     */
-    public function escapeString($str)
+    private function escapeString($str)
     {
         return str_replace('<', '\\<', $str);
     }