Re: [PHP-DEV] [RFC - discussion] __toArray()

This is only part of a thread. view whole thread
  108412
February 6, 2020 12:05 nikita.ppv@gmail.com (Nikita Popov)
On Tue, Feb 4, 2020 at 2:03 PM Steven Wade <stevenwadejr@gmail.com> wrote:

> Hi all, > > I’d like to officially open my __toArray() RFC < > https://wiki.php.net/rfc/to-array> up to discussion. I’ve delayed > changing the status until I had more time to respond to the discussion, but > since it’s been brought up again <https://externals.io/message/108351>, I > figured now is the best time. > > https://wiki.php.net/rfc/to-array <https://wiki.php.net/rfc/to-array>
One of the things that stand out to me in this RFC is that once you set strict_types=1 (which surely we all do :P), not a lot is left of it. While there are quite a few places where objects can be implicitly converted to strings (say echo, concatenation, etc), there are not a lot of places where objects can be implicitly converted to array. A quick grep has around 500 string conversions in the codebase, and 20 array conversions. Nikita
  108416
February 6, 2020 19:03 mike@newclarity.net (Mike Schinkel)
> > On Feb 6, 2020 at 7:06 AM, mailto:nikita.ppv@gmail.com)> wrote: > > While there are quite a few places where objects can be implicitly > > converted to strings (say echo, concatenation, etc), there are not > > a lot of places where objects can be implicitly converted to array. > > A quick grep has around 500 string conversions in the codebase, > > and 20 array conversions. > > > Out of curiosity, what did you grep for in both cases?
Were those string conversions done with casting to string? -Mike
> > > >