Skip to content

Commit

Permalink
Use argument unpacking.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 16, 2016
1 parent ab9a458 commit dcfdb3d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Providers/CommandServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function register()
foreach (array_keys($this->commands) as $command) {
$method = "register{$command}Command";

call_user_func_array([$this, $method], []);
$this->{$method}();
}

$this->commands(array_values($this->commands));
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function createDriver($driverName)
if (isset($this->customCreators[$driver])) {
return $this->callCustomCreator($driverName);
} elseif (method_exists($this, $method)) {
return call_user_func([$this, $method], $name);
return $this->{$method}($name);
}

throw new InvalidArgumentException("Driver [$driver] not supported.");
Expand All @@ -61,7 +61,7 @@ protected function callCustomCreator($driverName)
{
list($driver, $name) = $this->getDriverName($driverName);

return call_user_func($this->customCreators[$driver], $this->app, $name);
return $this->customCreators[$driver]($this->app, $name);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Support/Morph.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public static function __callStatic($method, $parameters)
throw new RuntimeException("Unable to call [{$method}].");
}

return call_user_func_array(static::$prefix.snake_case($method), $parameters);
$callback = static::$prefix.snake_case($method);

return $callback(...$parameters);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Nesty.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function pickTraverseFromMatchedExpression($id, $key, $location)

$method = $matching[$key];

return call_user_func([$this, $method], $id, $location);
return $this->{$method}($id, $location);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Traits/Macroable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function macro($name, $macro)
public function __call($method, $parameters)
{
if (isset($this->macros[$method])) {
return call_user_func_array($this->macros[$method], $parameters);
return $this->macros[$method](...$parameters);
}

throw new \BadMethodCallException("Method {$method} does not exist.");
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Traits/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function getBindedRules()
protected function runQueuedOn()
{
if (! is_null($method = $this->validationScenarios['on'])) {
call_user_func_array([$this, $method], $this->validationScenarios['parameters']);
$this->{$method}(...$this->validationScenarios['parameters']);
}
}

Expand Down

0 comments on commit dcfdb3d

Please sign in to comment.