Skip to content

Commit f939a68

Browse files
committed
Optimize perf by replacing call_user_func with dynamic vars
1 parent c74f4d1 commit f939a68

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function run(InputInterface $input, OutputInterface $output)
250250
$input->validate();
251251

252252
if ($this->code) {
253-
$statusCode = \call_user_func($this->code, $input, $output);
253+
$statusCode = ($this->code)($input, $output);
254254
} else {
255255
$statusCode = $this->execute($input, $output);
256256
}

Helper/ProcessHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function wrapCallback(OutputInterface $output, Process $process, callable
121121
$output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
122122

123123
if (null !== $callback) {
124-
\call_user_func($callback, $type, $buffer);
124+
$callback($type, $buffer);
125125
}
126126
};
127127
}

Helper/ProgressBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ private function buildLine(): string
496496
$regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
497497
$callback = function ($matches) {
498498
if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
499-
$text = \call_user_func($formatter, $this, $this->output);
499+
$text = $formatter($this, $this->output);
500500
} elseif (isset($this->messages[$matches[1]])) {
501501
$text = $this->messages[$matches[1]];
502502
} else {

Helper/ProgressIndicator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private function display()
196196

197197
$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
198198
if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
199-
return \call_user_func($formatter, $self);
199+
return $formatter($self);
200200
}
201201

202202
return $matches[0];

Helper/QuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private function validateAttempts(callable $interviewer, OutputInterface $output
381381
}
382382

383383
try {
384-
return \call_user_func($question->getValidator(), $interviewer());
384+
return $question->getValidator()($interviewer());
385385
} catch (RuntimeException $e) {
386386
throw $e;
387387
} catch (\Exception $error) {

0 commit comments

Comments
 (0)