Merge "Tolerate invalid titles in some ChangesFeed and LogFormatter code"
[lhc/web/wiklou.git] / includes / libs / services / ServiceContainer.php
index 59e5c4b..d1f1052 100644 (file)
@@ -1,7 +1,9 @@
 <?php
+
 namespace Wikimedia\Services;
 
 use InvalidArgumentException;
+use Psr\Container\ContainerInterface;
 use RuntimeException;
 use Wikimedia\Assert\Assert;
 
@@ -43,7 +45,7 @@ use Wikimedia\Assert\Assert;
  * @see docs/injection.txt for an overview of using dependency injection in the
  *      MediaWiki code base.
  */
-class ServiceContainer implements DestructibleService {
+class ServiceContainer implements ContainerInterface, DestructibleService {
 
        /**
         * @var object[]
@@ -192,6 +194,11 @@ class ServiceContainer implements DestructibleService {
                return isset( $this->serviceInstantiators[$name] );
        }
 
+       /** @inheritDoc */
+       public function has( $name ) {
+               return $this->hasService( $name );
+       }
+
        /**
         * Returns the service instance for $name only if that service has already been instantiated.
         * This is intended for situations where services get destroyed/cleaned up, so we can
@@ -399,7 +406,7 @@ class ServiceContainer implements DestructibleService {
         * @throws ContainerDisabledException if this container has already been destroyed.
         * @throws ServiceDisabledException if the requested service has been disabled.
         *
-        * @return object The service instance
+        * @return mixed The service instance
         */
        public function getService( $name ) {
                if ( $this->destroyed ) {
@@ -417,6 +424,11 @@ class ServiceContainer implements DestructibleService {
                return $this->services[$name];
        }
 
+       /** @inheritDoc */
+       public function get( $name ) {
+               return $this->getService( $name );
+       }
+
        /**
         * @param string $name
         *