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

Breadcrumb

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

class SubscribedService

For use as the return value for { @example new SubscribedService('http_client', HttpClientInterface::class, false, new Target('githubApi'))

Use with {as a subscribed service.

@author Kevin Bond <kevinbond@gmail.com>

Hierarchy

  • class \Symfony\Contracts\Service\Attribute\SubscribedService

Expanded class hierarchy of SubscribedService

See also

ServiceSubscriberInterface}.

ServiceMethodsSubscriberTrait} to mark a method's return type

5 files declare their use of SubscribedService
AutowireLocator.php in vendor/symfony/dependency-injection/Attribute/AutowireLocator.php
RegisterServiceSubscribersPass.php in vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php
ServiceMethodsSubscriberTrait.php in vendor/symfony/service-contracts/ServiceMethodsSubscriberTrait.php
ServiceSubscriberInterface.php in vendor/symfony/service-contracts/ServiceSubscriberInterface.php
ServiceSubscriberTrait.php in vendor/symfony/service-contracts/ServiceSubscriberTrait.php

File

vendor/symfony/service-contracts/Attribute/SubscribedService.php, line 27

Namespace

Symfony\Contracts\Service\Attribute
View source
final class SubscribedService {
    
    /** @var object[] */
    public array $attributes;
    
    /**
     * @param string|null       $key        The key to use for the service
     * @param class-string|null $type       The service class
     * @param bool              $nullable   Whether the service is optional
     * @param object|object[]   $attributes One or more dependency injection attributes to use
     */
    public function __construct(?string $key = null, ?string $type = null, bool $nullable = false, array|object $attributes = []) {
        $this->attributes = \is_array($attributes) ? $attributes : [
            $attributes,
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
SubscribedService::$attributes public property @var object[]
SubscribedService::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal