public static function Inspector::assertStringable in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Component/Assertion/Inspector.php \Drupal\Component\Assertion\Inspector::assertStringable()
Asserts argument is a string or an object castable to a string.
Use this instead of is_string() alone unless the argument being an object in any way will cause a problem.
Parameters
mixed $string: Variable to be examined
Return value
bool TRUE if $string is a string or an object castable to a string.
1 call to Inspector::assertStringable()
- Inspector::assertAllStringable in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts all members are strings or objects with magic __toString() method.
File
- core/
lib/ Drupal/ Component/ Assertion/ Inspector.php, line 117
Class
Namespace
Drupal\Component\AssertionCode
public static function assertStringable($string) {
return is_string($string) || is_object($string) && method_exists($string, '__toString');
}