Problem/Motivation
[EA] 'array_merge(...)' is used in a loop and is a resources greedy construction.
See https://github.com/kalessil/phpinspectionsea/blob/master/docs/performanc...
Steps to reproduce
Proposed resolution
Example :
// @see core/modules/views/src/Plugin/views/query/Sql.php
public function getWhereArgs() {
- $args = [];
- foreach ($this->where as $where) {
- $args = array_merge($args, $where['args']);
- }
- foreach ($this->having as $having) {
- $args = array_merge($args, $having['args']);
- }
- return $args;
+ return array_merge([], ...array_column($this->where, 'args'), ...array_column($this->having, 'args'));
}