issues
search
phpro
/
grumphp
A PHP code-quality tool
MIT License
4.11k
stars
429
forks
source link
Replace the array_merge with spread array operator
#1111
Closed
peter279k
closed
9 months ago
peter279k
commented
9 months ago
Q
A
Branch
v2.x
Bug fix?
no
New feature?
no
BC breaks?
no
Deprecations?
no
Documented?
no
Fixed tickets
comma-separated list of tickets fixed by the PR, if any
According to the
reference
, it's great to use the spread array operator to replace the
array_merge
function.
There're two reasons about using the spread array operator:
Spread operator should have a better performance than array_merge and compile time optimization can be performant for constant arrays.
array_merge
only supports array, while the spread operator also supports objects implementing
Traversable
.
New Task Checklist:
[x] Are the dependencies added to the composer.json suggestions?
[x] Is the doc/tasks.md file updated?
[x] Are the task parameters documented?
[x] Is the task registered in the tasks.yml file?
[x] Does the task contains phpunit tests?
[x] Is the configuration having logical allowed types?
[x] Does the task run in the correct context?
[x] Is the
run()
method readable?
[x] Is the
run()
method using the configuration correctly?
[x] Are all CI services returning green?
veewee
commented
9 months ago
Thanks
array_merge
function.array_merge
only supports array, while the spread operator also supports objects implementingTraversable
.New Task Checklist:
run()
method readable?run()
method using the configuration correctly?