So the last point was thinking about how to interpret
@param DateInterval ...$intervals
versus
@param DateInterval[] ...$intervals
Stefano and I appear to agree that the first one fits correctly with code
signature
function gatherIntervals (DateInterval ...$intervals)
where individual DateInterval objects are passed in as arguments, whereas
the second one fits with
function gatherIntervals (array ...$intervals)
where a series arrays of DateInterval objects are passed in as arguments.
Are there any further use cases to consider, such that this defined usage
of "[]" with "..." will not suffice?
CRB
On Tuesday, October 16, 2018 at 12:38:41 PM UTC-5, Stefano Torresi wrote:
>
> Thanks Chuck,
> That's what I thought, i.e. the presence of `...` already implies that the
> parameter is an array, so adding [] should not mean the same thing.
>
> Il giorno mar 16 ott 2018 alle ore 15:03 Chuck Burgess <[email protected]
> <javascript:>> ha scritto:
>
>> On Monday, October 15, 2018 at 4:23:46 PM UTC-5, Stefano Torresi wrote:
>>>
>>> Hey list,
>>> what if one wanted to hint to a varable number of arrays of DateInterval?
>>>
>>> e.g. `func(array ...$intervals) {}`
>>>
>>> Isn't this what `@param DateInterval[] ...$intervals` should actually
>>> be used for?
>>>
>>> Cheers
>>>
>>
>>
>> I had thought of this possibility soon after my original email... but was
>> self-throttling until today to bring it up :-D
>>
>> I agree with Stefano, that this use case is feasible, and thus the syntax
>> needs to account for it.
>>
>> So, the datatype part of the syntax represents a series of DateInterval
>> objects being passed individually, then `@param DateInterval ...$intervals`.
>>
>> If it's actually a series of *arrays* that each contain DateInterval
>> object members, then `@param DateInterval[] ...$intervals` would signify
>> that.
>>
>> CRB
>>
>
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/ee0cf7b9-3705-4787-b71e-5d7251fe8499%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.