/**
* A central location for static variable storage.
- *
- * @code
+ * @var array
+ * ```
* `Civi::$statics[__CLASS__]['foo'] = 'bar';
- * @endcode
+ * ```
*/
- public static $statics = array();
+ public static $statics = [];
/**
* Retrieve a named cache instance.
* @return \Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
public static function dispatcher() {
- return Civi\Core\Container::singleton()->get('dispatcher');
+ // NOTE: The dispatcher object is initially created as a boot service
+ // (ie `dispatcher.boot`). For compatibility with the container (eg
+ // `RegisterListenersPass` and `createEventDispatcher` addons),
+ // it is also available as the `dispatcher` service.
+ //
+ // The 'dispatcher.boot' and 'dispatcher' services are the same object,
+ // but 'dispatcher.boot' is resolvable earlier during bootstrap.
+ return Civi\Core\Container::getBootService('dispatcher.boot');
}
/**
}
/**
- * @return \Psr\Log\LoggerInterface
+ * @return \CRM_Core_Error_Log
*/
public static function log() {
return Civi\Core\Container::singleton()->get('psr_log');
* singletons, containers.
*/
public static function reset() {
- self::$statics = array();
+ self::$statics = [];
Civi\Core\Container::singleton();
}