Browse Source
perf(PHP): Use static closures for registrations
Micro performance optimization as it allows PHP to GC the surrounding
class earlier when `$this` isn't bound to the closure.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/8577/head
Christoph Wurst
3 years ago
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with
2 additions and
2 deletions
lib/AppInfo/Application.php
@ -198,7 +198,7 @@ class Application extends App implements IBootstrap {
/** @var IProviderManager $resourceManager */
$resourceManager = $server -> get ( IProviderManager :: class );
$resourceManager -> registerResourceProvider ( ConversationProvider :: class );
$server -> getEventDispatcher () -> addListener ( LoadAdditionalScriptsEvent :: class , function () {
$server -> getEventDispatcher () -> addListener ( LoadAdditionalScriptsEvent :: class , static function () {
Util :: addScript ( self :: APP_ID , 'talk-collections' );
});
}
@ -212,7 +212,7 @@ class Application extends App implements IBootstrap {
}
protected function registerNavigationLink ( IServerContainer $server ) : void {
$server -> getNavigationManager () -> add ( function () use ( $server ) {
$server -> getNavigationManager () -> add ( static function () use ( $server ) {
/** @var Config $config */
$config = $server -> get ( Config :: class );
$user = $server -> getUserSession () -> getUser ();