function 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.
1 call to Inspector::assertTraversable()
- InspectorTest::testAssertTraversable in core/
tests/ Drupal/ Tests/ Component/ Assertion/ InspectorTest.php - Tests asserting argument is an array or traversable object.
File
-
core/
lib/ Drupal/ Component/ Assertion/ Inspector.php, line 30
Class
Namespace
Drupal\Component\AssertionCode
public static function assertTraversable($traversable) {
return is_array($traversable) || $traversable instanceof \Traversable;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.