> On Nov 17, 2019, at 6:51 PM, Rowan Tommins wrote:
>
> I'm not sure avoiding the name "toArray" necessarily leads to "really long
> method names" - even with extremely specific distinctions, you don't need to
> call the method "toJsonArrayForVersion5OfTheApi", just "toV5Json" or
>
On 17/11/2019 23:01, Mike Schinkel wrote:
Consider this: __toArray() is hardly a rare case where a short
name can be applied in multiple contexts. We have infinite
contexts where we need to name methods for one context that might
conflict with others, and so I have been
> On Nov 17, 2019, at 17:28, Mike Schinkel wrote:
>
> If we are going to open up arrays for enhancement in PHP 8 I would ask that
> we seriously consider addressing the various differences between a built-in
> array and an instance of ArrayObject and/or the related associated interfaces
>
> On Nov 17, 2019, at 9:41 AM, Aimeos | Norbert Sendetzky
> wrote:
>
> Since PHP 7.1 there's the "iterable" pseudo type hint that matches
> "array" and "Traversable".
>
> PHP frameworks would profit from support of an "arrayable" pseudo type
> hint that matches "array" and all objects that
> On Nov 17, 2019, at 2:27 PM, Rowan Tommins wrote:
> Well, pretty much any method that returns array *could* be called "to array",
> but not many would be good candidates for such a generic name. You might
> return an array structure to be incorporated into a JSON response, or to be
> passed
[Note: I've included the full text of the previous message as it wasn't
sent to the list.]
On 17/11/2019 18:35, Aimeos | Norbert Sendetzky wrote:
It feels like there are two alternative suggestions here. Not only do
they use the same keyword to mean different things, but "convertible to
On 17/11/2019 14:41, Aimeos | Norbert Sendetzky wrote:
PHP frameworks would profit from support of an "arrayable" pseudo type
hint that matches "array" and all objects that implements "Traversable",
"ArrayAccess" and "Countable".
...
It would be useful to implement an Arrayable interface
>>> And if necessary, we can convert them to native arrays:
>>>
>>> if( $arrayable instanceof \Arrayable ) {
>>>$arrayable = $arrayable->toArray();
>>> }
>>
>> Also the toArray() should be called when an Arrayable is cast to an array:
>> (array)$arrayable.
>>
>> And shouldn’t the toArray match
I proposed a while back adding a new magic method __toArray that would
automatically cast. I'm halfway through writing the RFC (in draft and
unpublished).
I wonder how that could tie in to this proposal. Or even be a precursor to
this.
Sent from my iPhone
> On Nov 17, 2019, at 11:10 AM,
On Sun, Nov 17, 2019 at 9:42 AM Aimeos | Norbert Sendetzky <
norb...@aimeos.com> wrote:
> Since PHP 7.1 there's the "iterable" pseudo type hint that matches
> "array" and "Traversable".
>
> PHP frameworks would profit from support of an "arrayable" pseudo type
> hint that matches "array" and all
Since PHP 7.1 there's the "iterable" pseudo type hint that matches
"array" and "Traversable".
PHP frameworks would profit from support of an "arrayable" pseudo type
hint that matches "array" and all objects that implements "Traversable",
"ArrayAccess" and "Countable".
Thus, we could pass arrays
11 matches
Mail list logo