Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Assert.php

function Assert::implementsInterface

@psalm-pure @psalm-template ExpectedType of object @psalm-param class-string<ExpectedType> $interface @psalm-assert class-string<ExpectedType> $value

Parameters

mixed $value:

mixed $interface:

string $message:

Throws

InvalidArgumentException

1 call to Assert::implementsInterface()
StandardTagFactory::registerTagHandler in vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php
Registers a handler for tags.

File

vendor/webmozart/assert/src/Assert.php, line 1578

Class

Assert
Efficient assertions to validate the input/output of your methods.

Namespace

Webmozart\Assert

Code

public static function implementsInterface($value, $interface, $message = '') {
    if (!\in_array($interface, \class_implements($value))) {
        static::reportInvalidArgument(\sprintf($message ?: 'Expected an implementation of %2$s. Got: %s', static::valueToString($value), static::valueToString($interface)));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal