You are here

public static function Inspector::assertTraversable in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Assertion/Inspector.php \Drupal\Component\Assertion\Inspector::assertTraversable()

Asserts argument can be traversed with foreach.

Parameters

mixed $traversable: Variable to be examined.

Return value

bool TRUE if $traversable can be traversed with foreach.

8 calls to Inspector::assertTraversable()
Inspector::assertAll in core/lib/Drupal/Component/Assertion/Inspector.php
Asserts callback returns TRUE for each member of a traversable.
Inspector::assertAllHaveKey in core/lib/Drupal/Component/Assertion/Inspector.php
Asserts all given keys exist in every member array.
Inspector::assertAllMatch in core/lib/Drupal/Component/Assertion/Inspector.php
Asserts that all members are strings that contain the specified string.
Inspector::assertAllNotEmpty in core/lib/Drupal/Component/Assertion/Inspector.php
Asserts that all members are not empty.
Inspector::assertAllObjects in core/lib/Drupal/Component/Assertion/Inspector.php
Asserts that all members are objects.

... See full list

File

core/lib/Drupal/Component/Assertion/Inspector.php, line 30

Class

Inspector
Generic inspections for the assert() statement.

Namespace

Drupal\Component\Assertion

Code

public static function assertTraversable($traversable) {
  return is_array($traversable) || $traversable instanceof \Traversable;
}