I've found the following false positive for this inspection:
$language = 2;
$translations = [
['language' => 1, 'desc' => 'translated1']
['language' => 2, 'desc' => 'translated2']
];
$data = ['desc' => 'original'];
foreach ($translations as $translation) {
if ($translation['language'] === $language) {
$data = array_merge($data, $record);
break;
}
}
^ It's just an example, but there are a few cases where this might happen. This might also apply to other statements like return.
Docs: https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md#slow-array-function-used-in-loop
Thank you for reporting @uuf6429, I'll take care of the issue.
Fixed
Most helpful comment
Fixed