Skip to content

Commit ac0add4

Browse files
Benjamin Schultzbschultz
authored andcommitted
Optimize function calls
[EA] '$item->$method()' would make more sense here (it's also faster).
1 parent 5a00463 commit ac0add4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Component/ComponentItemList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public function sort(string $field, string $direction = self::SORT_ASC): void
4242

4343
$this->uasort(function (ComponentItem $item, ComponentItem $item2) use ($method, $direction) {
4444
if ($direction === self::SORT_DESC) {
45-
return \call_user_func([$item2, $method]) <=> \call_user_func([$item, $method]);
45+
return $item2->$method() <=> $item->$method();
4646
}
4747

48-
return \call_user_func([$item, $method]) <=> \call_user_func([$item2, $method]);
48+
return $item->$method() <=> $item2->$method();
4949
});
5050
}
5151

0 commit comments

Comments
 (0)