protected static function AssertHelperTrait::castSafeStrings in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/AssertHelperTrait.php \Drupal\Tests\AssertHelperTrait::castSafeStrings()
Casts MarkupInterface objects into strings.
Parameters
string|array $value: The value to act on.
Return value
mixed The input value, with MarkupInterface objects casted to string.
Deprecated
in drupal:9.2.0 and is removed from drupal:10.0.0. There is no replacement, just use assertEquals in tests.
See also
https://www.drupal.org/node/3123638
1 call to AssertHelperTrait::castSafeStrings()
- AssertHelperTestClass::testMethod in core/tests/ fixtures/ AssertHelperTestClass.php 
File
- core/tests/ Drupal/ Tests/ AssertHelperTrait.php, line 33 
Class
- AssertHelperTrait
- Provides helper methods for assertions.
Namespace
Drupal\TestsCode
protected static function castSafeStrings($value) {
  @trigger_error('AssertHelperTrait::castSafeStrings() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. There is no replacement; assertEquals() will automatically cast MarkupInterface to strings when needed. See https://www.drupal.org/node/3123638', E_USER_DEPRECATED);
  if ($value instanceof MarkupInterface) {
    $value = (string) $value;
  }
  if (is_array($value)) {
    array_walk_recursive($value, function (&$item) {
      if ($item instanceof MarkupInterface) {
        $item = (string) $item;
      }
    });
  }
  return $value;
}