ServiceProviderInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Contracts\Service;
  11. use Psr\Container\ContainerInterface;
  12. /**
  13. * A ServiceProviderInterface exposes the identifiers and the types of services provided by a container.
  14. *
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. * @author Mateusz Sip <mateusz.sip@gmail.com>
  17. */
  18. interface ServiceProviderInterface extends ContainerInterface
  19. {
  20. /**
  21. * Returns an associative array of service types keyed by the identifiers provided by the current container.
  22. *
  23. * Examples:
  24. *
  25. * * ['logger' => 'Psr\Log\LoggerInterface'] means the object provides a service named "logger" that implements Psr\Log\LoggerInterface
  26. * * ['foo' => '?'] means the container provides service name "foo" of unspecified type
  27. * * ['bar' => '?Bar\Baz'] means the container provides a service "bar" of type Bar\Baz|null
  28. *
  29. * @return string[] The provided service types, keyed by service names
  30. */
  31. public function getProvidedServices(): array;
  32. }