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)); } }
/** * {@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()); }