diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index ead402e..ec72283 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -18,9 +18,9 @@ '@Symfony' => true, 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => ['default' => 'align'], - 'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], 'native_function_invocation' => ['include' => ['@compiler_optimized']], 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], + 'phpdoc_add_missing_param_annotation' => false, 'self_accessor' => false, 'fopen_flags' => false, 'combine_consecutive_unsets' => true, diff --git a/composer.json b/composer.json index 88b2022..23cd87e 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,13 @@ "php": "^8.0" }, "require-dev": { - "doctrine/orm": "^2.9", + "doctrine/orm": "^2.10", "doctrine/mongodb-odm": "^2.2", - "friendsofphp/php-cs-fixer": "^3.1", + "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12", "symfony/framework-bundle": "^5.3", "symfony/lock": "^5.3", + "symfony/mercure": "^0.6", "symfony/messenger": "^5.3", "symfony/security-core": "^5.3", "symfony/security-csrf": "^5.3", diff --git a/src/Interfaces/LoggerAwareInterface.php b/src/Interfaces/LoggerAwareInterface.php index ead2d54..267e692 100644 --- a/src/Interfaces/LoggerAwareInterface.php +++ b/src/Interfaces/LoggerAwareInterface.php @@ -15,7 +15,7 @@ use Psr\Log\LoggerInterface; -interface LoggerAwareInterface extends LoggerInterface +interface LoggerAwareInterface { public function setLogger(LoggerInterface $logger): void; } diff --git a/src/Interfaces/MercureAuthorizationAwareInterface.php b/src/Interfaces/MercureAuthorizationAwareInterface.php new file mode 100644 index 0000000..3069b3a --- /dev/null +++ b/src/Interfaces/MercureAuthorizationAwareInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bacart\SymfonyAware\Interfaces; + +use Symfony\Component\Mercure\Authorization; + +interface MercureAuthorizationAwareInterface +{ + public function setMercureAuthorization(Authorization $mercureAuthorization): void; +} diff --git a/src/Interfaces/MercureHubAwareInterface.php b/src/Interfaces/MercureHubAwareInterface.php new file mode 100644 index 0000000..6679509 --- /dev/null +++ b/src/Interfaces/MercureHubAwareInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bacart\SymfonyAware\Interfaces; + +use Symfony\Component\Mercure\HubInterface; + +interface MercureHubAwareInterface +{ + public function setMercureHub(HubInterface $MercureHub): void; +} diff --git a/src/Traits/MercureAuthorizationAwareTrait.php b/src/Traits/MercureAuthorizationAwareTrait.php new file mode 100644 index 0000000..0843124 --- /dev/null +++ b/src/Traits/MercureAuthorizationAwareTrait.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bacart\SymfonyAware\Traits; + +use Symfony\Component\Mercure\Authorization; +use Symfony\Contracts\Service\Attribute\Required; + +trait MercureAuthorizationAwareTrait +{ + protected Authorization $mercureAuthorization; + + #[Required] + public function setMercureAuthorization(Authorization $mercureAuthorization): void + { + $this->mercureAuthorization = $mercureAuthorization; + } +} diff --git a/src/Traits/MercureHubAwareTrait.php b/src/Traits/MercureHubAwareTrait.php new file mode 100644 index 0000000..28aaa88 --- /dev/null +++ b/src/Traits/MercureHubAwareTrait.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bacart\SymfonyAware\Traits; + +use Symfony\Component\Mercure\HubInterface; +use Symfony\Contracts\Service\Attribute\Required; + +trait MercureHubAwareTrait +{ + protected HubInterface $mercureHub; + + #[Required] + public function setMercureHub(HubInterface $mercureHub): void + { + $this->mercureHub = $mercureHub; + } +}