private function autoResolve(string $class)
    {
        try {
            $reflection = new \ReflectionClass($class);
        } catch (\ReflectionException $exception) {
            throw new ContainerException(sprintf('Class "%s" does not exists', $class));
        }

        if (! $reflection->isInstantiable()) {
            throw new ContainerException(sprintf('Class "%s" is not instantiable', $class));
        }
        return $this->buildInstance($reflection);
    }
private function autoResolve(string $class)
    {
        try {
            $reflection = new \ReflectionClass($class);
        } catch (\ReflectionException $exception) {
            throw new ContainerException(sprintf('Class "%s" does not exists', $class));
        }

        if (! $reflection->isInstantiable()) {
            throw new ContainerException(sprintf('Class "%s" is not instantiable', $class));
        }
        return $this->buildInstance($reflection);
    }
private function autoResolve ( string $ class ) { try { $ reflection = new \ ReflectionClass ( $ class ) ; } catch ( \ ReflectionException $ exception ) { throw new ContainerException ( sprintf ( 'Class "%s" does not exists' , $ class ) ) ; } if ( ! $ reflection -> isInstantiable ( ) ) { throw new ContainerException ( sprintf ( 'Class "%s" is not instantiable' , $ class ) ) ; } return $ this -> buildInstance ( $ reflection ) ; }
Try to automatically create a service.

@param string $class The service class.

@return mixed The built instance.

@throws ContainerException If the service cannot be constructed.
Try to automatically create a service .