On Wed, Jul 1, 2026 at 4:52 PM Juliette Reinders Folmer < [email protected]> wrote:
> On 1-7-2026 21:18, Seifeddine Gmati wrote: > > On Wed, 1 Jul 2026 at 19:36, Michael Morris <[email protected]> > <[email protected]> wrote: > > On Mon, Jun 29, 2026 at 2:38 PM Seifeddine Gmati <[email protected]> > <[email protected]> wrote: > > On Mon, 29 Jun 2026 at 18:52, Rowan Tommins [IMSoP]<[email protected]> > <[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. > > > > Hi all, > > 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. > > The migration is running a single command: `ast-grep -p > 'array($$$ARGS)' -r '[$$$ARGS]' --lang php -U` > > I don't think the WordPress team would have trouble replacing > `array()` with `[]` given that the minimum requirement for WordPress > is PHP 8.3. Older WordPress installations don't have to upgrade > because if they didn't bother upgrading WordPress, i doubt they will > bother upgrading PHP :) > > > Sorry to butt in, but a) the minimum PHP for WP is PHP 7.4 at the moment > and b) the arguments for WordPress to stick with the old `array()` and > `list()` has nothing to do with them "not bothering to upgrade". They are > fully aware of the ease of upgrading and the (PHPCS) tooling to do so is > available and has been for the longest time. > > Reasons for WordPress to **not** switch to short array/list syntax are far > more along the lines of: > * Code accessibility - it is much quicker to determine whether something > is a list or an array when visually scanning code when the keywords are > being used. > * Searchability of the code base - searching for `array(` or `list(` will > yield useful results, searching for `[` will yield a hundred times more > results, most of which are not what one is looking for (array access, > assignments etc). > > Other than that, they've brought up practical reasons for not switching to > the new syntax in the past. Think along the lines of there being thousands > of (often long-standing) open patches, which would need to be updated > before they can be merged. The extra burden this would put on the limited > amount of committers is another reason. > > So, please, if you use WP in this discussion to argue either side, please > inform yourself before doing so. > > Personally, I believe both the code accessibility as well as the > searchability arguments do have some value, so it might be a good idea for > the discussion to focus more on those. > > Smile, > Juliette > > I didn't delve into the reasons WordPress is that way because I don't know them. I assumed they had them - no project that size that has ran that long does anything without much deliberation. It's not just the core team that has to change, it's all the plugins. Most sites have considerable custom theme code - the one I'm responsible for does. I don't use array() but there are corners I haven't touched yet that might because I inherited it. I could run that query, but I wouldn't be comfortable doing it because there are no tests for that old code. I do have tests, but most all of them step over the PHP backend and focus on the output of the twig templates because that's easier to test in the first place. I do have a sanity test that iterates over 150 pages of the site looking for PHP and JavaScript errors in the output or console, but that's a bare minimum. A lot of WordPress sites are ran by small outfits with no coder on staff at all and they delegate the server operation to a provider. Those providers often have hundreds, some thousands of sites. They don't have the staff to update every bloody one of them. This can be done. I strongly, strongly advise caution on it. Honestly, this is what I mean by saying perhaps it's time to have a strict mode language that is code first instead of template first among other features that would be nice to do but have severe BC implications.
