Loading core/lib/Drupal.php +5 −7 Original line number Diff line number Diff line Loading @@ -193,17 +193,15 @@ public static function hasContainer() { /** * Retrieves a service from the container. * * Use this method if the desired service is not one of those with a dedicated * accessor method below. If it is listed below, those methods are preferred * as they can return useful type hints. * * @param string $id * @param class-string<T>|string $id * The ID of the service to retrieve. * * @return mixed * @template T of object * * @return ($id is class-string<T> ? T : object) * The specified service. */ public static function service($id) { public static function service(string $id): object { return static::getContainer()->get($id); } Loading Loading
core/lib/Drupal.php +5 −7 Original line number Diff line number Diff line Loading @@ -193,17 +193,15 @@ public static function hasContainer() { /** * Retrieves a service from the container. * * Use this method if the desired service is not one of those with a dedicated * accessor method below. If it is listed below, those methods are preferred * as they can return useful type hints. * * @param string $id * @param class-string<T>|string $id * The ID of the service to retrieve. * * @return mixed * @template T of object * * @return ($id is class-string<T> ? T : object) * The specified service. */ public static function service($id) { public static function service(string $id): object { return static::getContainer()->get($id); } Loading