File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,10 @@ public function getParametersFromValidationRules(array $validationRulesByParamet
141
141
}
142
142
143
143
/**
144
- * Transform validation rules from:
144
+ * Transform validation rules:
145
+ * 1. from strings to arrays:
145
146
* 'param1' => 'int|required' TO 'param1' => ['int', 'required']
147
+ * 2. from '*.foo' to '
146
148
*
147
149
* @param array<string,string|string[]> $rules
148
150
*
@@ -169,7 +171,10 @@ protected function normaliseRules(array $rules): array
169
171
return collect ($ newRules )->mapWithKeys (function ($ val , $ paramName ) use ($ rules ) {
170
172
// Transform the key names back from '__asterisk__' to '*'
171
173
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
+ // See https://github.com/laravel/framework/pull/54845/
177
+ $ paramName = preg_replace ('/__asterisk__[^.]*\b/ ' , '* ' , $ paramName );
173
178
}
174
179
175
180
// 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()
81
81
);
82
82
}
83
83
84
-
85
84
/** @test */
86
85
public function can_transform_arrays_and_objects ()
87
86
{
You can’t perform that action at this time.
0 commit comments