Skip to content

Commit a989377

Browse files
committed
call_user_func replaced with expression
1 parent b45de14 commit a989377

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/Application/MicroPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function run(Application\Request $request)
8484
$params['presenter'] = $this;
8585
$params = Application\UI\ComponentReflection::combineArgs($reflection, $params);
8686

87-
$response = call_user_func_array($callback, $params);
87+
$response = $callback(...array_values($params));
8888

8989
if (is_string($response)) {
9090
$response = [$response, []];

src/Application/PresenterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(callable $factory = NULL)
4646
*/
4747
public function createPresenter($name)
4848
{
49-
return call_user_func($this->factory, $this->getPresenterClass($name));
49+
return ($this->factory)($this->getPresenterClass($name));
5050
}
5151

5252

src/Application/Responses/CallbackResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(callable $callback)
3636
*/
3737
public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse)
3838
{
39-
call_user_func($this->callback, $httpRequest, $httpResponse);
39+
($this->callback)($httpRequest, $httpResponse);
4040
}
4141

4242
}

src/Application/Routers/Route.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function match(Nette\Http\IRequest $httpRequest)
227227
return NULL; // rejected by filterTable
228228

229229
} elseif (isset($meta[self::FILTER_IN])) { // applies filterIn only to scalar parameters
230-
$params[$name] = call_user_func($meta[self::FILTER_IN], (string) $params[$name]);
230+
$params[$name] = $meta[self::FILTER_IN]((string) $params[$name]);
231231
if ($params[$name] === NULL && !isset($meta['fixity'])) {
232232
return NULL; // rejected by filter
233233
}
@@ -239,7 +239,7 @@ public function match(Nette\Http\IRequest $httpRequest)
239239
}
240240

241241
if (isset($this->metadata[NULL][self::FILTER_IN])) {
242-
$params = call_user_func($this->metadata[NULL][self::FILTER_IN], $params);
242+
$params = $this->metadata[NULL][self::FILTER_IN]($params);
243243
if ($params === NULL) {
244244
return NULL;
245245
}
@@ -302,7 +302,7 @@ public function constructUrl(Application\Request $appRequest, Nette\Http\Url $re
302302
}
303303

304304
if (isset($metadata[NULL][self::FILTER_OUT])) {
305-
$params = call_user_func($metadata[NULL][self::FILTER_OUT], $params);
305+
$params = $metadata[NULL][self::FILTER_OUT]($params);
306306
if ($params === NULL) {
307307
return NULL;
308308
}
@@ -336,7 +336,7 @@ public function constructUrl(Application\Request $appRequest, Nette\Http\Url $re
336336
return NULL;
337337

338338
} elseif (isset($meta[self::FILTER_OUT])) {
339-
$params[$name] = call_user_func($meta[self::FILTER_OUT], $params[$name]);
339+
$params[$name] = $meta[self::FILTER_OUT]($params[$name]);
340340
}
341341

342342
if (isset($meta[self::PATTERN]) && !preg_match($meta[self::PATTERN], rawurldecode($params[$name]))) {
@@ -581,7 +581,7 @@ private function setMask($mask, array $metadata)
581581
$meta['defOut'] = $meta['filterTable2'][$meta[self::VALUE]];
582582

583583
} elseif (isset($meta[self::FILTER_OUT])) {
584-
$meta['defOut'] = call_user_func($meta[self::FILTER_OUT], $meta[self::VALUE]);
584+
$meta['defOut'] = $meta[self::FILTER_OUT]($meta[self::VALUE]);
585585

586586
} else {
587587
$meta['defOut'] = $meta[self::VALUE];

src/Application/UI/Multiplier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(callable $factory)
2828

2929
protected function createComponent($name)
3030
{
31-
return call_user_func($this->factory, $name, $this);
31+
return ($this->factory)($name, $this);
3232
}
3333

3434
}

src/Bridges/ApplicationDI/ApplicationExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ private function findPresenters()
142142
$classFile = dirname($rc->getFileName()) . '/autoload_classmap.php';
143143
if (is_file($classFile)) {
144144
$this->getContainerBuilder()->addDependency($classFile);
145-
$classes = array_merge($classes, array_keys(call_user_func(function ($path) {
145+
$classes = array_merge($classes, array_keys((function ($path) {
146146
return require $path;
147-
}, $classFile)));
147+
})($classFile)));
148148
}
149149
}
150150

0 commit comments

Comments
 (0)