No Description

SubscribedService.php 800B

12345678910111213141516171819202122232425262728293031323334
  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\Attribute;
  11. use Symfony\Contracts\Service\ServiceSubscriberTrait;
  12. /**
  13. * Use with {@see ServiceSubscriberTrait} to mark a method's return type
  14. * as a subscribed service.
  15. *
  16. * @author Kevin Bond <kevinbond@gmail.com>
  17. */
  18. #[\Attribute(\Attribute::TARGET_METHOD)]
  19. final class SubscribedService
  20. {
  21. /**
  22. * @param string|null $key The key to use for the service
  23. * If null, use "ClassName::methodName"
  24. */
  25. public function __construct(
  26. public ?string $key = null
  27. ) {
  28. }
  29. }