Support php's array callable format for macro's.

This allows you to define methods like this as well: Str::macro('name', [$this, 'method']);
This commit is contained in:
Ezra Pool
2018-02-03 21:10:48 +01:00
parent 2b1273c45e
commit 8ab907f219
2 changed files with 24 additions and 5 deletions
+8 -3
View File
@@ -10,14 +10,19 @@ class Macro extends Method
/**
* Macro constructor.
*
* @param \ReflectionFunction $method
* @param \ReflectionFunctionAbstract $method
* @param string $alias
* @param \ReflectionClass $class
* @param null $methodName
* @param array $interfaces
*/
public function __construct(\ReflectionFunction $method, $alias, $class, $methodName = null, $interfaces = array())
{
public function __construct(
\ReflectionFunctionAbstract $method,
$alias,
$class,
$methodName = null,
$interfaces = array()
) {
$this->method = $method;
$this->interfaces = $interfaces;
$this->name = $methodName ?: $method->name;