Nelmio\Alice\Throwable\Error\TypeErrorFactory::createForObjectArgument PHP 메소드

createForObjectArgument() 공개 정적인 메소드

public static createForObjectArgument ( $instance ) : TypeError
리턴 TypeError
    public static function createForObjectArgument($instance) : \TypeError
    {
        return new \TypeError(sprintf('Expected instance argument to be an object, got "%s" instead.', gettype($instance)));
    }

Usage Example

예제 #1
0
 /**
  * @param string  $reference
  * @param object $instance
  */
 public function __construct(string $reference, $instance)
 {
     if (false === is_object($instance)) {
         throw TypeErrorFactory::createForObjectArgument($instance);
     }
     $this->reference = $reference;
     $this->instance = $instance;
 }