File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,10 @@ public function getParametersFromValidationRules(array $validationRulesByParamet
141141 }
142142
143143 /**
144- * Transform validation rules from:
144+ * Transform validation rules:
145+ * 1. from strings to arrays:
145146 * 'param1' => 'int|required' TO 'param1' => ['int', 'required']
147+ * 2. from '*.foo' to '
146148 *
147149 * @param array<string,string|string[]> $rules
148150 *
@@ -169,7 +171,9 @@ protected function normaliseRules(array $rules): array
169171 return collect ($ newRules )->mapWithKeys (function ($ val , $ paramName ) use ($ rules ) {
170172 // Transform the key names back from '__asterisk__' to '*'
171173 if (Str::contains ($ paramName , '__asterisk__ ' )) {
172- $ paramName = str_replace ('__asterisk__ ' , '* ' , $ paramName );
174+ // In Laravel < v11.44, * keys were replaced with only "__asterisk__"
175+ // After that, * keys were replaced with "__asterisk__<random placeholder>", eg "__asterisk__dkjiu78gujjhb
176+ $ paramName = preg_replace ('/__asterisk__[^.]*\b/ ' , '* ' , $ paramName );
173177 }
174178
175179 // Transform the key names back from 'ids.0' to 'ids.*'
Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ public function can_parse_rule_objects()
8181 );
8282 }
8383
84-
8584 /** @test */
8685 public function can_transform_arrays_and_objects ()
8786 {
You can’t perform that action at this time.
0 commit comments