Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 30, 2024
1 parent bf52454 commit 2086023
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions HtmlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public static function htmlClasses(...$args): string
} elseif (\is_array($arg)) {
foreach ($arg as $class => $condition) {
if (!\is_string($class)) {
throw new RuntimeError(\sprintf('The html_classes function argument %d (key %d) should be a string, got "%s".', $i, $class, get_debug_type($class)));
throw new RuntimeError(\sprintf('The "html_classes" function argument %d (key %d) should be a string, got "%s".', $i, $class, get_debug_type($class)));
}
if (!$condition) {
continue;
}
$classes[] = $class;
}
} else {
throw new RuntimeError(\sprintf('The html_classes function argument %d should be either a string or an array, got "%s".', $i, get_debug_type($arg)));
throw new RuntimeError(\sprintf('The "html_classes" function argument %d should be either a string or an array, got "%s".', $i, get_debug_type($arg)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/html_classes_with_unsupported_arg.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
--DATA--
return []
--EXCEPTION--
Twig\Error\RuntimeError: The html_classes function argument 0 should be either a string or an array, got "boolean" in "index.twig" at line 2.
Twig\Error\RuntimeError: The "html_classes" function argument 0 should be either a string or an array, got "bool" in "index.twig" at line 2.
2 changes: 1 addition & 1 deletion Tests/Fixtures/html_classes_with_unsupported_key.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
--DATA--
return []
--EXCEPTION--
Twig\Error\RuntimeError: The html_classes function argument 0 (key 0) should be a string, got "integer" in "index.twig" at line 2.
Twig\Error\RuntimeError: The "html_classes" function argument 0 (key 0) should be a string, got "int" in "index.twig" at line 2.

0 comments on commit 2086023

Please sign in to comment.