File tree 1 file changed +2
-6
lines changed
components/expression_language
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ This method has 3 arguments:
35
35
36
36
$language = new ExpressionLanguage();
37
37
$language->register('lowercase', function ($str) {
38
- is_string(%1$s) ? strtolower(%1$s) : %1$s;
38
+ return sprintf('( is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str) ;
39
39
}, function ($arguments, $str) {
40
40
if (!is_string($str)) {
41
41
return $str;
@@ -69,11 +69,7 @@ Override ``registerFunctions`` to add your own functions::
69
69
parent::registerFunctions(); // do not forget to also register core functions
70
70
71
71
$this->register('lowercase', function ($str) {
72
- if (!is_string($str)) {
73
- return $str;
74
- }
75
-
76
- return sprintf('strtolower(%s)', $str);
72
+ return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
77
73
}, function ($arguments, $str) {
78
74
if (!is_string($str)) {
79
75
return $str;
You can’t perform that action at this time.
0 commit comments