summaryrefslogtreecommitdiff
path: root/vendor/symfony/service-contracts/Attribute/SubscribedService.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
committerpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
commitbf6655a534a6775d30cafa67bd801276bda1d98d (patch)
treec6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/symfony/service-contracts/Attribute/SubscribedService.php
parent94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff)
downloadAppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/symfony/service-contracts/Attribute/SubscribedService.php')
-rw-r--r--vendor/symfony/service-contracts/Attribute/SubscribedService.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/symfony/service-contracts/Attribute/SubscribedService.php b/vendor/symfony/service-contracts/Attribute/SubscribedService.php
new file mode 100644
index 0000000..f850b84
--- /dev/null
+++ b/vendor/symfony/service-contracts/Attribute/SubscribedService.php
@@ -0,0 +1,47 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Contracts\Service\Attribute;
13
14use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait;
15use Symfony\Contracts\Service\ServiceSubscriberInterface;
16
17/**
18 * For use as the return value for {@see ServiceSubscriberInterface}.
19 *
20 * @example new SubscribedService('http_client', HttpClientInterface::class, false, new Target('githubApi'))
21 *
22 * Use with {@see ServiceMethodsSubscriberTrait} to mark a method's return type
23 * as a subscribed service.
24 *
25 * @author Kevin Bond <kevinbond@gmail.com>
26 */
27#[\Attribute(\Attribute::TARGET_METHOD)]
28final class SubscribedService
29{
30 /** @var object[] */
31 public array $attributes;
32
33 /**
34 * @param string|null $key The key to use for the service
35 * @param class-string|null $type The service class
36 * @param bool $nullable Whether the service is optional
37 * @param object|object[] $attributes One or more dependency injection attributes to use
38 */
39 public function __construct(
40 public ?string $key = null,
41 public ?string $type = null,
42 public bool $nullable = false,
43 array|object $attributes = [],
44 ) {
45 $this->attributes = \is_array($attributes) ? $attributes : [$attributes];
46 }
47}