File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
tests/Functional/ViewHelpers Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public function render(): string
6767 $ value = $ this ->arguments ['value ' ] ?? $ this ->renderChildren ();
6868 $ search = $ this ->arguments ['search ' ];
6969 $ replace = $ this ->arguments ['replace ' ];
70- if ($ value === null || ( !is_scalar ($ value ) && !$ value instanceof \Stringable) ) {
70+ if ($ value !== null && !is_scalar ($ value ) && !$ value instanceof \Stringable) {
7171 throw new \InvalidArgumentException ('A stringable value must be provided. ' , 1710441987 );
7272 }
7373 if ($ search === null ) {
Original file line number Diff line number Diff line change @@ -20,12 +20,6 @@ final class ReplaceViewHelperTest extends AbstractFunctionalTestCase
2020{
2121 public static function throwsExceptionForInvalidArgumentDataProvider (): iterable
2222 {
23- yield 'without value ' => [
24- '<f:replace search="foo" replace="bar" /> ' ,
25- [],
26- 1710441987 ,
27- 'A stringable value must be provided. ' ,
28- ];
2923 yield 'array as value ' => [
3024 '{value -> f:replace(search: \'foo \', replace: \'bar \')} ' ,
3125 ['value ' => [1 , 2 , 3 ]],
@@ -132,6 +126,11 @@ public static function renderDataProvider(): iterable
132126 ['value ' => '' ],
133127 '' ,
134128 ];
129+ yield 'with null as value ' => [
130+ '<f:replace search="foo" replace="bar" value="{null}" /> ' ,
131+ [],
132+ '' ,
133+ ];
135134 }
136135
137136 #[DataProvider('renderDataProvider ' )]
You can’t perform that action at this time.
0 commit comments