On Wed 1 Jul 2026, 20:35 Michael Morris, <[email protected]> wrote:

>
>
> On Mon, Jun 29, 2026 at 2:38 PM Seifeddine Gmati <[email protected]>
> wrote:
>
>> On Mon, 29 Jun 2026 at 18:52, Rowan Tommins [IMSoP]
>> <[email protected]> wrote:
>> >
>> > On 29/06/2026 17:37, Seifeddine Gmati wrote:
>> > > Hello Internals,
>> > >
>> > > I have updated the RFC to include a deprecation proposal for the
>> > > `list()` construct.
>> > >
>> > > ref:
>> https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_the_list_construct
>> >
>> >
>> > I don't think it makes sense to deprecate list() if we're not
>> > deprecating array() - they're exact counterparts, and both replaced by
>> > the [] syntax. Indeed, [] as a replacement for array() dates to PHP 5.4,
>> > but as a replacement for list() was only added in PHP 7.1.
>>
>> I'm actually in favor of deprecating `array()` too, and I raised this
>> on the #php-internals Discord channel.
>
>
> Are you crazy? That would invalidate at least three quarters of the
> WordPress core code base and almost all of it's plugins, not to mention
> THOUSANDS of tutorials on stack overflow.  And whether you like it or not
> about 40-60% of PHP sites use WordPress, depending on who you ask.
>
> That would almost certainly cause that community to either refuse to
> upgrade, leading to the problem the Python community faced with 2 & 3, or
> cause them to fork PHP.
>
> To be clear, I find it ugly as Hell too, and I'd love to see the end of
> the @ error suppression operator, but there are things that simply cannot
> be done.
>


That's a very strong stance. It would invalidate a lot of old code but it's
a very simple change that can be done automatically. Most of the up-to-date
code already switched to the new syntax so there is a trend in community's
code towards the new style. Deprecating array() would only speed it up.

We're not talking here about deprecating arrays, just the old array()
construct.

Deprecating list() is a little more challenging as not enough time has
passed for old codebases to migrate to the new syntax but it also wouldn't
be world shattering as the change is very simple.

The benefit of this would be that we would be modernizing the language and
removing two ways of doing the identical thing, which would be a very good
thing for new users. No more confusion and messy code.

Compared to the error suppression operator or pass-by-ref, this is a very
simple and unproblematic deprecation. We might want to delay the removal
until PHP 10 but I see no reason to hold back on deprecation.

>

Reply via email to