[13.x] Add size methods to the array rule builder

Merged
RI
10d ago
+157-2

Since #61833 nearly every rule has a builder, but the size of an array still needs a string next to Rule::array():

'photos' => [Rule::required(), Rule::array(), 'min:1'],

'photos' => [Rule::required(), Rule::array()->min(1)],

This adds min(), max(), between() and exactly() to ArrayRule, same as on Rule::string(). They also work with keys: Rule::array(['a', 'b'])->min(1) gives array:a,b|min:1.

ValidationRuleParser needed ArrayRule added to the builders it splits on |, like #59207 did for StringRule.

I know #54517 was closed, but that one also added list(), distinct() etc. which have their own builders now. This only covers the size rules.