Commit

df67a73

working through a massive #php refactor and finally got to use static in a closure for a loop. i used to instantiate reused services outside if the closure and made them available with use. i always hated that they weren't able to be scoped properly due to performance reasons. small change, big improvement! I know this has been available since 8.1, but I was on a 7.4 island.
php
// Bad news with large arrays!
array_map(function($i) { 
    $mf = new MyFilter();
    $mf->filter($i);
}, range(0,5));

// Meh, it works
$mf = new MyFilter();
array_map(function($i) use($mf){ 
    $mf->filter($i);
}, range(0,5));

// FTW! Only called once and all necessary code exists together
array_map(function($i) { 
    static $mf = new MyFilter();
    $mf->filter($i);
}, range(0,5));

commit df67a73