Re: [PHP-DEV] [RFC] Deprecations for PHP 8.6

[email protected] (Juliette Reinders Folmer)
Newsgroups php.internals
Message-ID <[email protected]>
On 1-7-2026 23:35, Seifeddine Gmati wrote:
>> Sorry to butt in, but a) the minimum PHP for WP is PHP 7.4
> I got the 8.3 number from their official website:
> https://wordpress.org/about/requirements/ , even if the requirement is
> 7.1, the `[]` syntax works fine there. So, this is not a problem.

Please look again on the same page. The _recommended_ version may be PHP 
8.3, the minimum version ("Running on legacy versions?") is PHP 7.4 and 
only since recently.

>> * 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.
> `list(` does not mean a "list", PHP has no such type right now. It
> means you are destructuring an array, `list("foo" => $bar)` is valid.
> so "quicker to determine" is false, you can swap every `list(` usage
> with `array(` and the behavior will be exactly the same.

That's just plain untrue. The one is used for creating an array, the 
other for destructuring an array.

Swapping `list(` usages with `array(` will in most cases result in a 
parse error. Example: https://3v4l.org/O7O4q#veol

>
>> * 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).
> Yes, it would also yield `$typed->array(`, `$posts->list(`, and more.
> If you are looking for a specific syntax, you should use AST based
> search tools, not grep text. In which case, you can easily grep for
> array construction using `[]` over writes/reads using array-access
> syntax. This has never been a problem in every other language that
> uses `[]` syntax.
Agreed, but that doesn't take anything away from the fact that WP uses 
it as an argument against switching to the short syntax.

Smile,
Juliette
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.