File tree Expand file tree Collapse file tree 3 files changed +3
-18
lines changed Expand file tree Collapse file tree 3 files changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -108,29 +108,14 @@ protected function toCamelCase($str): string
108
108
109
109
$ str = \preg_replace ('/[^a-zA-Z0-9]+/ ' , ' ' , $ str );
110
110
$ str = \trim ($ str );
111
+ $ str = strtolower ($ str );
111
112
$ str = \ucwords ($ str );
112
113
$ str = \str_replace (' ' , '' , $ str );
113
114
$ str = \lcfirst ($ str );
114
115
115
116
return $ str ;
116
117
}
117
118
118
- protected function toLowerCamelCase ($ str ): string
119
- {
120
- // Normalize the string to decompose accented characters
121
- $ str = \Normalizer::normalize ($ str , \Normalizer::FORM_D );
122
-
123
- // Remove accents and other residual non-ASCII characters
124
- $ str = preg_replace ('/\p{M}/u ' , '' , $ str );
125
-
126
- // Replace non-alphanumeric characters with a space
127
- $ str = preg_replace ('/[^a-zA-Z0-9]+/ ' , ' ' , $ str );
128
- $ str = ucwords (strtolower ($ str ));
129
- $ str = lcfirst (str_replace (' ' , '' , $ str ));
130
-
131
- return $ str ;
132
- }
133
-
134
119
protected function toSnakeCase ($ str ): string
135
120
{
136
121
// Normalize the string to decompose accented characters
Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ public function getFilters(): array
507
507
return implode ("\n" , $ value );
508
508
}, ['is_safe ' => ['html ' ]]),
509
509
new TwigFilter ('caseEnumKey ' , function (string $ value ) {
510
- return $ this ->toLowerCamelCase ($ value );
510
+ return $ this ->toCamelCase ($ value );
511
511
}),
512
512
];
513
513
}
Original file line number Diff line number Diff line change @@ -471,7 +471,7 @@ public function getFilters(): array
471
471
if (isset ($ this ->getIdentifierOverrides ()[$ value ])) {
472
472
$ value = $ this ->getIdentifierOverrides ()[$ value ];
473
473
}
474
- return $ this ->toLowerCamelCase ($ value );
474
+ return $ this ->toCamelCase ($ value );
475
475
}),
476
476
];
477
477
}
You can’t perform that action at this time.
0 commit comments