feat: add support for parsing array options#10079
feat: add support for parsing array options#10079paulbalandan wants to merge 1 commit intocodeigniter4:4.8from
Conversation
a590a06 to
cebbe5a
Compare
cebbe5a to
c7d0aae
Compare
michalsn
left a comment
There was a problem hiding this comment.
The array options feature makes sense, but I'm worried about changing getOption() to sometimes return an array. Existing commands treat it as a scalar/flag accessor.
What do you think about keeping getOption() returning a single value, with a defined rule like "last value wins", and adding a separate method to retrieve all values for repeated options?
That would keep existing code safe while still supporting the new feature.
|
@michalsn, Illogical. Relying on the last key has no order. The array seems like a sure change. We have already created BC, so compatibility will be broken. In this case, for major changes, you already need to have a branch of ~10.x, as many major fixes have been made. Alternatively, you should update the contribution rules and specify that the minor branch may contain new features and BC. Has phpstan got new rules? A lot of mistakes |
CLI arguments absolutely have order.
My main concern is that changing But as always, I'm not gonna be stubborn. If the majority is okay with this, let's proceed.
Yes, I haven't had time to investigate, maybe on the weekend. |
|
I understand what you're talking about. In such cases, yes, the latter value looks acceptable. About the order. I mean, if we select the last value, will the |
|
Yes, in the first case you end up with This is natural: each occurrence overwrites the previous one. If the command isn't meant to handle arrays, If we want repeated parameters, |
Description
Support parsing
--option=foo --option=barinto['option' => ['foo', 'bar']].Checklist: