php / php/doc-en

Missing Information on Spread Operator and Array/Argument Unpacking

Open
#2,769 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

From manual page: https://php.net/language.operators


I noticed that there is not a lot of information on the spread operator and the variadic argument token/operator in the operator section .
There is more information on array unpacking on the data type, array page: https://www.php.net/manual/en/language.types.array.php#language.types.array.unpacking, but almost nothing on argument unpacking in the function section: https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments
I think it would make sense to add the spread operator in the operator section with information on array and argument unpacking, which can currently only be found in the rfc section:

It is probably very useful to know that argument unpacking works with named arguments. I also missed anything on the fact that you cannot use argument unpacking after named arguments, that is not mentioned even in the rfc seciton.

The variadic function parameter token/operator is not quite the same thing, but should also be mentioned here, I think.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked operator, array, and function-argument manual pages, then compare them with the referenced RFCs on argument and array unpacking. Document the spread operator, variadic parameters, array and argument unpacking, named-argument interactions, and the restriction on unpacking after named arguments in the appropriate sections.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.