src/Container.php
protected function resolve(string $abstract, array &$stack = []): Dependency
    {
        if (isset($this->aliases[$abstract])) {
            $alias = $this->aliases[$abstract];

            if (in_array($alias, $stack)) {
                $stack[] = $alias;
                $error = implode(' => ', $stack);
                throw new BindingException("Circular reference detected: $error");
            } else {
                $stack[] = $alias;
                return $this->resolve($alias, $stack);
            }
        }

        if (!isset($this->bindings[$abstract])) {
            $this->bind($abstract, null);
        }

        return $this->bindings[$abstract];
    }
protected function resolve(string $abstract, array &$stack = []): Dependency
    {
        if (isset($this->aliases[$abstract])) {
            $alias = $this->aliases[$abstract];

            if (in_array($alias, $stack)) {
                $stack[] = $alias;
                $error = implode(' => ', $stack);
                throw new BindingException("Circular reference detected: $error");
            } else {
                $stack[] = $alias;
                return $this->resolve($alias, $stack);
            }
        }

        if (!isset($this->bindings[$abstract])) {
            $this->bind($abstract, null);
        }

        return $this->bindings[$abstract];
    }
protected function resolve ( string $ abstract , array & $ stack = [ ] ) : Dependency { if ( isset ( $ this -> aliases [ $ abstract ] ) ) { $ alias = $ this -> aliases [ $ abstract ] ; if ( in_array ( $ alias , $ stack ) ) { $ stack [ ] = $ alias ; $ error = implode ( ' => ' , $ stack ) ; throw new BindingException ( "Circular reference detected: $error" ) ; } else { $ stack [ ] = $ alias ; return $ this -> resolve ( $ alias , $ stack ) ; } } if ( ! isset ( $ this -> bindings [ $ abstract ] ) ) { $ this -> bind ( $ abstract , null ) ; } return $ this -> bindings [ $ abstract ] ; }
Resolves an abstract type

@param string $abstract
@param array $stack
@return Dependency
Resolves an abstract type