public static function fromReflection(\ReflectionFunctionAbstract $reflection, callable $callable)
    {
        if (is_array($callable)) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = is_object($callable[0]) ? $callable[0] : null;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif (is_object($callable) && !($callable instanceof \Closure)) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = $callable;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif ($reflection->isClosure()) {
            $thisObject = $reflection->getClosureThis();
            $scopeClass = $reflection->getClosureScopeClass();
            $scopeType = $scopeClass === null ? null : $scopeClass->getName();
        } else {
            $thisObject = null;
            $scopeType = null;
        }
        $variableTable = $reflection->getStaticVariables();

        return new self($thisObject, $scopeType, $variableTable);
    }
public static function fromReflection(\ReflectionFunctionAbstract $reflection, callable $callable)
    {
        if (is_array($callable)) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = is_object($callable[0]) ? $callable[0] : null;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif (is_object($callable) && !($callable instanceof \Closure)) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = $callable;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif ($reflection->isClosure()) {
            $thisObject = $reflection->getClosureThis();
            $scopeClass = $reflection->getClosureScopeClass();
            $scopeType = $scopeClass === null ? null : $scopeClass->getName();
        } else {
            $thisObject = null;
            $scopeType = null;
        }
        $variableTable = $reflection->getStaticVariables();

        return new self($thisObject, $scopeType, $variableTable);
    }
public static function fromReflection ( \ ReflectionFunctionAbstract $ reflection , callable $ callable ) { if ( is_array ( $ callable ) ) { /** @var $reflection \ReflectionMethod */ $ thisObject = is_object ( $ callable [ 0 ] ) ? $ callable [ 0 ] : null ; $ scopeType = $ reflection -> getDeclaringClass ( ) -> getName ( ) ; } elseif ( is_object ( $ callable ) && ! ( $ callable instanceof \ Closure ) ) { /** @var $reflection \ReflectionMethod */ $ thisObject = $ callable ; $ scopeType = $ reflection -> getDeclaringClass ( ) -> getName ( ) ; } elseif ( $ reflection -> isClosure ( ) ) { $ thisObject = $ reflection -> getClosureThis ( ) ; $ scopeClass = $ reflection -> getClosureScopeClass ( ) ; $ scopeType = $ scopeClass === null ? null : $ scopeClass -> getName ( ) ; } else { $ thisObject = null ; $ scopeType = null ; } $ variableTable = $ reflection -> getStaticVariables ( ) ; return new self ( $ thisObject , $ scopeType , $ variableTable ) ; }
Creates a function scope instance from the supplied reflection and callable.

@param \ReflectionFunctionAbstract $reflection
@param callable                    $callable

@return self
Creates a function scope instance from the supplied reflection and callable .