public function asClass(string $className)
    {
        if (!is_a($className, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                    'Invalid call to %s: class name must be compatible with type %s, %s given',
                    __METHOD__, $this->class->getClassName(), $className
            );
        }

        $this->fromCallback(function () use ($className) {
            return $className;
        });
    }
public function asClass(string $className)
    {
        if (!is_a($className, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                    'Invalid call to %s: class name must be compatible with type %s, %s given',
                    __METHOD__, $this->class->getClassName(), $className
            );
        }

        $this->fromCallback(function () use ($className) {
            return $className;
        });
    }
public function asClass ( string $ className ) { if ( ! is_a ( $ className , $ this -> class -> getClassName ( ) , true ) ) { throw InvalidArgumentException :: format ( 'Invalid call to %s: class name must be compatible with type %s, %s given' , __METHOD__ , $ this -> class -> getClassName ( ) , $ className ) ; } $ this -> fromCallback ( function ( ) use ( $ className ) { return $ className ; } ) ; }
Defines the form to create new instances of the supplied type.

@param string $className

@return void
@throws InvalidArgumentException
Defines the form to create new instances of the supplied type .