Webmozart\Assert\Assert::isInstanceOf PHP Метод

isInstanceOf() публичный статический Метод

public static isInstanceOf ( $value, $class, $message = '' )
    public static function isInstanceOf($value, $class, $message = '')
    {
        if (!$value instanceof $class) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected an instance of %2$s. Got: %s', static::typeToString($value), $class));
        }
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function onCheckoutComplete(GenericEvent $event)
 {
     /** @var OrderInterface $order */
     $order = $event->getSubject();
     Assert::isInstanceOf($order, OrderInterface::class);
     $this->session->set('sylius_order_id', $order->getId());
 }
All Usage Examples Of Webmozart\Assert\Assert::isInstanceOf