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

Breadcrumb

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

function Assert::isTraversable

@psalm-pure @psalm-assert iterable $value

Parameters

mixed $value:

string $message:

Throws

InvalidArgumentException

Deprecated

use "isIterable" or "isInstanceOf" instead

File

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

Class

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

Namespace

Webmozart\Assert

Code

public static function isTraversable($value, $message = '') {
    @\trigger_error(\sprintf('The "%s" assertion is deprecated. You should stop using it, as it will soon be removed in 2.0 version. Use "isIterable" or "isInstanceOf" instead.', __METHOD__), \E_USER_DEPRECATED);
    if (!\is_array($value) && !$value instanceof Traversable) {
        static::reportInvalidArgument(\sprintf($message ?: 'Expected a traversable. Got: %s', static::typeToString($value)));
    }
}
RSS feed
Powered by Drupal