Php-cs-fixer: Fixer that replaces call_user_func_array() with argument unpacking

Created on 1 Jul 2019  ·  6Comments  ·  Source: FriendsOfPHP/PHP-CS-Fixer

e.g.:

-call_user_func_array($callable, $arguments);
+$callable(...$arguments);
kinfeature request

Most helpful comment

I would want the same for call_user_func() as well.

- call_user_func($callable, $a, $b, $c);
+ $callable($a, $b, $c);

All 6 comments

Just a note for whoever picks this up, this will break:

-call_user_func_array($this->callable, $arguments);
+$this->callable(...$arguments);

Here's a workaround:

-call_user_func_array($this->callable, $arguments);
+($this->callable)(...$arguments);

I would want the same for call_user_func() as well.

- call_user_func($callable, $a, $b, $c);
+ $callable($a, $b, $c);

FYI: I picked up this request.

4544

FYI: later named to rule regular_callable_call

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitek-rostislav picture vitek-rostislav  ·  3Comments

ndench picture ndench  ·  3Comments

datenmeister picture datenmeister  ·  3Comments

kcloze picture kcloze  ·  3Comments

grachevko picture grachevko  ·  3Comments