From 33cea8bc0e3f4647fa4299791859bdd7e88faaf8 Mon Sep 17 00:00:00 2001 From: Maxime Veber Date: Sun, 18 Feb 2024 17:03:39 +0100 Subject: [PATCH] :package: Update php cs fixer --- composer.json | 2 +- config/bundles.php | 2 +- src/DataCollector/DomainEventDataCollector.php | 2 +- src/Debug/TraceableDomainEventDispatcher.php | 2 +- src/Event/DomainEvent.php | 2 +- src/Event/DomainEventDispatcher.php | 2 +- .../VerifyDoctrineConfigurationCompilerPass.php | 3 --- src/Integration/Symfony/DomainBundle.php | 3 --- .../Symfony/Serializer/DomainDenormalizer.php | 11 ----------- src/Model/DomainModelTrait.php | 2 +- .../Instantiator/DoctrineConfig/ClassMetadata.php | 5 +---- .../DoctrineConfig/ClassMetadataFactory.php | 14 +------------- .../EntitiesHasDispatcherChecker.php | 1 - .../DoctrinePostPersistListener.php | 3 --- 14 files changed, 9 insertions(+), 45 deletions(-) diff --git a/composer.json b/composer.json index 363653e..806113c 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require-dev": { "phpunit/phpunit": "^9.5 || ^10", "doctrine/orm": "^2.6.3", - "friendsofphp/php-cs-fixer": "^3.11.0", + "friendsofphp/php-cs-fixer": "^3.49.0", "symfony/symfony": "^5.0 || ^6.0 || ^7.0", "phpspec/prophecy-phpunit": "^2.0.1", "monolog/monolog": "^2.8.0 || ^3.2.0" diff --git a/config/bundles.php b/config/bundles.php index 8653dd1..b125d6e 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -5,5 +5,5 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - \Biig\Component\Domain\Integration\Symfony\DomainBundle::class => ['all' => true], + Biig\Component\Domain\Integration\Symfony\DomainBundle::class => ['all' => true], ]; diff --git a/src/DataCollector/DomainEventDataCollector.php b/src/DataCollector/DomainEventDataCollector.php index fd551b3..01720e8 100644 --- a/src/DataCollector/DomainEventDataCollector.php +++ b/src/DataCollector/DomainEventDataCollector.php @@ -50,7 +50,7 @@ public function reset(): void $this->dispatcher->reset(); } - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null) { $this->currentRequest = $this->requestStack->getMainRequest() !== $request ? $request : null; $this->data = [ diff --git a/src/Debug/TraceableDomainEventDispatcher.php b/src/Debug/TraceableDomainEventDispatcher.php index 961eb82..a09611e 100644 --- a/src/Debug/TraceableDomainEventDispatcher.php +++ b/src/Debug/TraceableDomainEventDispatcher.php @@ -98,7 +98,7 @@ public function getDelayedListenersCalled(): array * * @return object The passed $event MUST be returned */ - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { $eventName = $eventName ?? get_class($event); $this->eventsFired[] = $eventName; diff --git a/src/Event/DomainEvent.php b/src/Event/DomainEvent.php index b9d51fb..575ebde 100644 --- a/src/Event/DomainEvent.php +++ b/src/Event/DomainEvent.php @@ -14,7 +14,7 @@ class DomainEvent extends GenericEvent */ private bool $delayed; - public function __construct($subject = null, $arguments = [], Event $originalEvent = null) + public function __construct($subject = null, $arguments = [], ?Event $originalEvent = null) { parent::__construct($subject, $arguments); $this->originalEvent = $originalEvent; diff --git a/src/Event/DomainEventDispatcher.php b/src/Event/DomainEventDispatcher.php index 1e0fc6b..1698165 100644 --- a/src/Event/DomainEventDispatcher.php +++ b/src/Event/DomainEventDispatcher.php @@ -78,7 +78,7 @@ public function addPostPersistDomainRuleInterface(PostPersistDomainRuleInterface * * @return Event */ - public function dispatch($event, string $eventName = null): object + public function dispatch($event, ?string $eventName = null): object { $event = parent::dispatch($event, $eventName); diff --git a/src/Integration/Symfony/DependencyInjection/CompilerPass/VerifyDoctrineConfigurationCompilerPass.php b/src/Integration/Symfony/DependencyInjection/CompilerPass/VerifyDoctrineConfigurationCompilerPass.php index 3117cfa..6972527 100644 --- a/src/Integration/Symfony/DependencyInjection/CompilerPass/VerifyDoctrineConfigurationCompilerPass.php +++ b/src/Integration/Symfony/DependencyInjection/CompilerPass/VerifyDoctrineConfigurationCompilerPass.php @@ -10,9 +10,6 @@ class VerifyDoctrineConfigurationCompilerPass implements CompilerPassInterface { - /** - * {@inheritdoc} - */ public function process(ContainerBuilder $container) { if ($container->getParameter('biig_domain_doctrine_domain_event_instantiator')) { diff --git a/src/Integration/Symfony/DomainBundle.php b/src/Integration/Symfony/DomainBundle.php index 8805789..70eb211 100644 --- a/src/Integration/Symfony/DomainBundle.php +++ b/src/Integration/Symfony/DomainBundle.php @@ -13,9 +13,6 @@ class DomainBundle extends Bundle { - /** - * {@inheritdoc} - */ public function getContainerExtension(): ?ExtensionInterface { return new DomainExtension(); diff --git a/src/Integration/Symfony/Serializer/DomainDenormalizer.php b/src/Integration/Symfony/Serializer/DomainDenormalizer.php index 73b02df..b035cc8 100644 --- a/src/Integration/Symfony/Serializer/DomainDenormalizer.php +++ b/src/Integration/Symfony/Serializer/DomainDenormalizer.php @@ -32,10 +32,6 @@ public function __construct(NormalizerInterface $decorated, DomainEventDispatche $this->dispatcher = $dispatcher; } - /** - * {@inheritdoc} - * @return mixed - */ public function denormalize($data, $class, $format = null, array $context = []) { $domain = $this->decorated->denormalize($data, $class, $format, $context); @@ -47,16 +43,12 @@ public function denormalize($data, $class, $format = null, array $context = []) return $domain; } - /** - * {@inheritdoc} - */ public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $this->decorated->supportsDenormalization($data, $type, $format, $context); } /** - * {@inheritdoc} * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) @@ -64,9 +56,6 @@ public function normalize($object, $format = null, array $context = []) return $this->decorated->normalize($object, $format, $context); } - /** - * {@inheritdoc} - */ public function supportsNormalization($data, $format = null, array $context = []): bool { return $this->decorated->supportsNormalization($data, $format, $context); diff --git a/src/Model/DomainModelTrait.php b/src/Model/DomainModelTrait.php index 327847a..83e32dd 100644 --- a/src/Model/DomainModelTrait.php +++ b/src/Model/DomainModelTrait.php @@ -38,7 +38,7 @@ public function setDispatcher(DomainEventDispatcherInterface $dispatcher) } } - protected function dispatch(DomainEvent $event, string $name = null) + protected function dispatch(DomainEvent $event, ?string $name = null) { if (null === $this->dispatcher) { $eventToStack['event'] = $event; diff --git a/src/Model/Instantiator/DoctrineConfig/ClassMetadata.php b/src/Model/Instantiator/DoctrineConfig/ClassMetadata.php index 84de74b..7ac8bd0 100644 --- a/src/Model/Instantiator/DoctrineConfig/ClassMetadata.php +++ b/src/Model/Instantiator/DoctrineConfig/ClassMetadata.php @@ -20,15 +20,12 @@ class ClassMetadata extends BaseClassMetadata */ private $instantiator; - public function __construct($entityName, InstantiatorInterface $instantiator, NamingStrategy $namingStrategy = null) + public function __construct($entityName, InstantiatorInterface $instantiator, ?NamingStrategy $namingStrategy = null) { parent::__construct($entityName, $namingStrategy); $this->instantiator = $instantiator; } - /** - * {@inheritdoc} - */ public function newInstance(): object { return $this->instantiator->instantiate(parent::newInstance($this->name)); diff --git a/src/Model/Instantiator/DoctrineConfig/ClassMetadataFactory.php b/src/Model/Instantiator/DoctrineConfig/ClassMetadataFactory.php index f951dff..f646446 100644 --- a/src/Model/Instantiator/DoctrineConfig/ClassMetadataFactory.php +++ b/src/Model/Instantiator/DoctrineConfig/ClassMetadataFactory.php @@ -9,7 +9,7 @@ use Doctrine\Persistence\Mapping\ClassMetadata as ClassMetadataInterface; use Doctrine\Persistence\Mapping\ReflectionService; -if (interface_exists(\Doctrine\Persistence\Mapping\ClassMetadata::class)) { +if (interface_exists(ClassMetadataInterface::class)) { final class ClassMetadataFactory extends BaseClassMetadataFactory { /** @@ -22,9 +22,6 @@ final class ClassMetadataFactory extends BaseClassMetadataFactory */ private $entityManager; - /** - * {@inheritdoc} - */ public function newClassMetadataInstance($className): ClassMetadata { return new ClassMetadata($className, new Instantiator($this->dispatcher), $this->entityManager->getConfiguration()->getNamingStrategy()); @@ -35,9 +32,6 @@ public function setDispatcher(DomainEventDispatcherInterface $dispatcher) $this->dispatcher = $dispatcher; } - /** - * {@inheritdoc} - */ protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService): void { if ($class instanceof ClassMetadata) { @@ -69,9 +63,6 @@ final class ClassMetadataFactory extends BaseClassMetadataFactory */ private $entityManager; - /** - * {@inheritdoc} - */ public function newClassMetadataInstance($className): ClassMetadata { return new ClassMetadata($className, new Instantiator($this->dispatcher), $this->entityManager->getConfiguration()->getNamingStrategy()); @@ -82,9 +73,6 @@ public function setDispatcher(DomainEventDispatcherInterface $dispatcher) $this->dispatcher = $dispatcher; } - /** - * {@inheritdoc} - */ protected function wakeupReflection(OldClassMetadataInterface $class, ReflectionService $reflService): void { if ($class instanceof ClassMetadata) { diff --git a/src/PostFlushListener/EntitiesHasDispatcherChecker.php b/src/PostFlushListener/EntitiesHasDispatcherChecker.php index ee8bf78..e52ea14 100644 --- a/src/PostFlushListener/EntitiesHasDispatcherChecker.php +++ b/src/PostFlushListener/EntitiesHasDispatcherChecker.php @@ -10,7 +10,6 @@ use Biig\Component\Domain\Model\ModelInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Event\PostFlushEventArgs; -use Doctrine\ORM\Proxy\Proxy; final class EntitiesHasDispatcherChecker { diff --git a/src/PostPersistListener/DoctrinePostPersistListener.php b/src/PostPersistListener/DoctrinePostPersistListener.php index efdddca..a1d5ddc 100644 --- a/src/PostPersistListener/DoctrinePostPersistListener.php +++ b/src/PostPersistListener/DoctrinePostPersistListener.php @@ -27,9 +27,6 @@ public function __construct(DomainEventDispatcherInterface $dispatcher) $this->modelsStageForFlush = []; } - /** - * {@inheritdoc} - */ public function getSubscribedEvents() { return ['onFlush', 'postFlush'];