Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContainerInterface.php

interface ContainerInterface

Same name in this branch
  1. 11.1.x vendor/psr/container/src/ContainerInterface.php \Psr\Container\ContainerInterface
  2. 11.1.x core/lib/Drupal/Component/DependencyInjection/ContainerInterface.php \Drupal\Component\DependencyInjection\ContainerInterface

ContainerInterface is the interface implemented by service container classes.

@author Fabien Potencier <fabien@symfony.com> @author Johannes M. Schmitt <schmittjoh@gmail.com>

Hierarchy

  • interface \Psr\Container\ContainerInterface
    • interface \Symfony\Component\DependencyInjection\ContainerInterface extends \Psr\Container\ContainerInterface

Expanded class hierarchy of ContainerInterface

All classes that implement ContainerInterface

630 files declare their use of ContainerInterface
AccountForm.php in core/modules/user/src/AccountForm.php
AccountSettingsForm.php in core/modules/user/src/AccountSettingsForm.php
AddFormBase.php in core/modules/media_library/src/Form/AddFormBase.php
AddItemToToolbar.php in core/modules/ckeditor5/src/Plugin/ConfigAction/AddItemToToolbar.php
AddModeration.php in core/modules/content_moderation/src/Plugin/ConfigAction/AddModeration.php

... See full list

File

vendor/symfony/dependency-injection/ContainerInterface.php, line 25

Namespace

Symfony\Component\DependencyInjection
View source
interface ContainerInterface extends PsrContainerInterface {
    public const RUNTIME_EXCEPTION_ON_INVALID_REFERENCE = 0;
    public const EXCEPTION_ON_INVALID_REFERENCE = 1;
    public const NULL_ON_INVALID_REFERENCE = 2;
    public const IGNORE_ON_INVALID_REFERENCE = 3;
    public const IGNORE_ON_UNINITIALIZED_REFERENCE = 4;
    public function set(string $id, ?object $service) : void;
    
    /**
     * @template B of self::*_REFERENCE
     *
     * @param B $invalidBehavior
     *
     * @psalm-return (B is self::EXCEPTION_ON_INVALID_REFERENCE|self::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE ? object : object|null)
     *
     * @throws ServiceCircularReferenceException When a circular reference is detected
     * @throws ServiceNotFoundException          When the service is not defined
     *
     * @see Reference
     */
    public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) : ?object;
    public function has(string $id) : bool;
    
    /**
     * Check for whether or not a service has been initialized.
     */
    public function initialized(string $id) : bool;
    
    /**
     * @throws ParameterNotFoundException if the parameter is not defined
     */
    public function getParameter(string $name) : array|bool|string|int|float|\UnitEnum|null;
    public function hasParameter(string $name) : bool;
    public function setParameter(string $name, array|bool|string|int|float|\UnitEnum|null $value) : void;

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE public constant
ContainerInterface::get public function @template B of self::*_REFERENCE Overrides ContainerInterface::get 2
ContainerInterface::getParameter public function 2
ContainerInterface::has public function Returns true if the container can return an entry for the given identifier.
Returns false otherwise.
Overrides ContainerInterface::has 2
ContainerInterface::hasParameter public function 2
ContainerInterface::IGNORE_ON_INVALID_REFERENCE public constant
ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE public constant
ContainerInterface::initialized public function Check for whether or not a service has been initialized. 2
ContainerInterface::NULL_ON_INVALID_REFERENCE public constant
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE public constant
ContainerInterface::set public function 2
ContainerInterface::setParameter public function 2
RSS feed
Powered by Drupal