From 897df39d96b5e3407fa7c54ce23d97e5015a5c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B8=D0=B2=D0=B8=D1=87=20=D0=A1=D0=B5=D1=80?= =?UTF-8?q?=D0=B3=D0=B5=D0=B9?= Date: Wed, 20 Jul 2022 14:38:42 +0300 Subject: [PATCH] Update code base --- DependencyInjection/Configuration.php | 8 ---- .../RetailCrmServiceExtension.php | 9 ---- .../InvalidRequestArgumentException.php | 19 +------- Messenger/CommandMessage.php | 48 ++----------------- Messenger/MessageHandler.php | 20 +------- .../MessageHandler/InNewProcessRunner.php | 35 ++------------ Messenger/MessageHandler/JobRunner.php | 8 ---- .../MessageHandler/SimpleConsoleRunner.php | 28 +---------- Messenger/Middleware/LockableMessage.php | 5 -- .../Middleware/LockableMessageMiddleware.php | 23 +-------- Models/Error.php | 20 ++------ Response/ErrorJsonResponseFactory.php | 22 +-------- Serializer/Adapter.php | 19 -------- Serializer/JMSSerializerAdapter.php | 28 +---------- Serializer/SymfonySerializerAdapter.php | 28 +---------- Tests/DataFixtures/RequestDto.php | 8 +--- .../DependencyInjection/ConfigurationTest.php | 5 -- .../RetailCrmServiceExtensionTest.php | 5 -- Tests/Fixtures/App/Kernel.php | 9 +--- Tests/Messenger/CommandMessageTest.php | 5 -- .../MessageHandler/InNewProcessRunnerTest.php | 5 -- .../SimpleConsoleRunnerTest.php | 5 -- Tests/Messenger/MessageHandlerTest.php | 5 -- .../LockableMessageMiddlewareTest.php | 18 ++----- Tests/Serializer/JMSSerializerAdapterTest.php | 2 +- 25 files changed, 28 insertions(+), 359 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 96d7c6b..12f5fdf 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -5,16 +5,8 @@ namespace RetailCrm\ServiceBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; -/** - * Class Configuration - * - * @package RetailCrm\ServiceBundle\DependencyInjection - */ class Configuration implements ConfigurationInterface { - /** - * {@inheritdoc } - */ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('retail_crm_service'); diff --git a/DependencyInjection/RetailCrmServiceExtension.php b/DependencyInjection/RetailCrmServiceExtension.php index 4e27c45..10d7805 100644 --- a/DependencyInjection/RetailCrmServiceExtension.php +++ b/DependencyInjection/RetailCrmServiceExtension.php @@ -14,17 +14,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Reference; -/** - * Class RetailCrmServiceExtension - * - * @package RetailCrm\ServiceBundle\DependencyInjection - */ class RetailCrmServiceExtension extends Extension { - /** - * @param array $configs - * @param ContainerBuilder $container - */ public function load(array $configs, ContainerBuilder $container): void { $configuration = $this->getConfiguration($configs, $container); diff --git a/Exceptions/InvalidRequestArgumentException.php b/Exceptions/InvalidRequestArgumentException.php index 4d990f1..2d8403e 100644 --- a/Exceptions/InvalidRequestArgumentException.php +++ b/Exceptions/InvalidRequestArgumentException.php @@ -5,33 +5,18 @@ namespace RetailCrm\ServiceBundle\Exceptions; use InvalidArgumentException; use Throwable; -/** - * Class InvalidRequestArgumentException - * - * @package RetailCrm\ServiceBundle\Exceptions - */ class InvalidRequestArgumentException extends InvalidArgumentException { private $validateErrors; - /** - * InvalidRequestArgumentException constructor. - * @param string $message - * @param int $code - * @param array $errors - * @param Throwable|null $previous - */ - public function __construct($message = "", $code = 0, iterable $errors = [], Throwable $previous = null) + public function __construct(string $message = "", int $code = 0, array $errors = [], Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->validateErrors = $errors; } - /** - * @return iterable - */ - public function getValidateErrors(): iterable + public function getValidateErrors(): array { return $this->validateErrors; } diff --git a/Messenger/CommandMessage.php b/Messenger/CommandMessage.php index 139030f..abb9a4d 100644 --- a/Messenger/CommandMessage.php +++ b/Messenger/CommandMessage.php @@ -2,91 +2,54 @@ namespace RetailCrm\ServiceBundle\Messenger; -/** - * Class Message - * - * @package RetailCrm\ServiceBundle\Messenger - */ abstract class CommandMessage { - /** @var string */ - protected $commandName; + protected string $commandName; - /** @var array */ - protected $options = []; + protected array $options = []; - /** @var array */ - protected $arguments = []; + protected array $arguments = []; - /** - * @return string - */ public function getCommandName(): string { return $this->commandName; } - /** - * @param string $commandName - */ public function setCommandName(string $commandName): void { $this->commandName = $commandName; } - /** - * @return array - */ public function getOptions(): array { return $this->options; } - /** - * @param array $options - */ public function setOptions(array $options): void { $this->options = $options; } - /** - * @return array - */ public function getArguments(): array { return $this->arguments; } - /** - * @param array $arguments - */ public function setArguments(array $arguments): void { $this->arguments = $arguments; } - /** - * @param string $key - * @param string $value - */ public function addOption(string $key, string $value): void { $this->options[$key] = $value; } - /** - * @param string $key - * @param string $value - */ public function addArgument(string $key, string $value): void { $this->arguments[$key] = $value; } - /** - * @return array - */ public function getFormattedOptions(): array { $options = []; @@ -97,11 +60,6 @@ abstract class CommandMessage return $options; } - /** - * For lockable message - * - * @return array - */ public function __serialize(): array { return [ diff --git a/Messenger/MessageHandler.php b/Messenger/MessageHandler.php index 6f38fa3..9cb94e0 100644 --- a/Messenger/MessageHandler.php +++ b/Messenger/MessageHandler.php @@ -6,31 +6,13 @@ use RetailCrm\ServiceBundle\Messenger\MessageHandler\JobRunner; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Exception; -/** - * Class MessageHandler - * - * @package RetailCrm\ServiceBundle\Messenger - */ class MessageHandler implements MessageHandlerInterface { - /** - * @var JobRunner - */ - private $runner; - - /** - * CommandQueueHandler constructor. - * - * @param JobRunner $runner - */ - public function __construct(JobRunner $runner) + public function __construct(private JobRunner $runner) { - $this->runner = $runner; } /** - * @param CommandMessage $message - * * @throws Exception */ public function __invoke(CommandMessage $message): void diff --git a/Messenger/MessageHandler/InNewProcessRunner.php b/Messenger/MessageHandler/InNewProcessRunner.php index da0abff..1b5dedd 100644 --- a/Messenger/MessageHandler/InNewProcessRunner.php +++ b/Messenger/MessageHandler/InNewProcessRunner.php @@ -9,38 +9,17 @@ use Symfony\Component\Process\Exception\ProcessTimedOutException; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; -/** - * Class InNewProcessRunner - * - * @package RetailCrm\ServiceBundle\Messenger\MessageHandler - */ class InNewProcessRunner implements JobRunner { /** @var int Default timeout for process */ public const DEFAULT_TIMEOUT = 3600; - /** - * @var LoggerInterface - */ - private $logger; + private LoggerInterface $logger; - /** - * @var KernelInterface - */ - private $kernel; + private KernelInterface $kernel; - /** - * @var int - */ - private $timeout = self::DEFAULT_TIMEOUT; + private int $timeout = self::DEFAULT_TIMEOUT; - /** - * CommandQueueHandler constructor. - * - * @param LoggerInterface $logger - * @param KernelInterface $kernel - * @param int|null $timeout - */ public function __construct( LoggerInterface $logger, KernelInterface $kernel, @@ -54,9 +33,6 @@ class InNewProcessRunner implements JobRunner } } - /** - * {@inheritdoc} - */ public function run(CommandMessage $message): void { $phpBinaryPath = (new PhpExecutableFinder)->find(); @@ -92,11 +68,6 @@ class InNewProcessRunner implements JobRunner } } - /** - * @param CommandMessage $message - * - * @return array - */ private function getOptions(CommandMessage $message): array { $options = []; diff --git a/Messenger/MessageHandler/JobRunner.php b/Messenger/MessageHandler/JobRunner.php index 350e847..38a4dd8 100644 --- a/Messenger/MessageHandler/JobRunner.php +++ b/Messenger/MessageHandler/JobRunner.php @@ -4,15 +4,7 @@ namespace RetailCrm\ServiceBundle\Messenger\MessageHandler; use RetailCrm\ServiceBundle\Messenger\CommandMessage; -/** - * Interface JobRunner - * - * @package RetailCrm\ServiceBundle\Messenger\MessageHandler - */ interface JobRunner { - /** - * @param CommandMessage $message - */ public function run(CommandMessage $message): void; } diff --git a/Messenger/MessageHandler/SimpleConsoleRunner.php b/Messenger/MessageHandler/SimpleConsoleRunner.php index 0291d8d..c50aaae 100644 --- a/Messenger/MessageHandler/SimpleConsoleRunner.php +++ b/Messenger/MessageHandler/SimpleConsoleRunner.php @@ -9,38 +9,12 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\HttpKernel\KernelInterface; -/** - * Class SimpleConsoleRunner - * - * @package RetailCrm\ServiceBundle\Messenger\MessageHandler - */ class SimpleConsoleRunner implements JobRunner { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var KernelInterface - */ - private $kernel; - - /** - * CommandQueueHandler constructor. - * - * @param LoggerInterface $logger - * @param KernelInterface $kernel - */ - public function __construct(LoggerInterface $logger, KernelInterface $kernel) + public function __construct(private LoggerInterface $logger, private KernelInterface $kernel) { - $this->logger = $logger; - $this->kernel = $kernel; } - /** - * {@inheritdoc} - */ public function run(CommandMessage $message): void { $application = new Application($this->kernel); diff --git a/Messenger/Middleware/LockableMessage.php b/Messenger/Middleware/LockableMessage.php index 9550df3..4e49597 100644 --- a/Messenger/Middleware/LockableMessage.php +++ b/Messenger/Middleware/LockableMessage.php @@ -2,11 +2,6 @@ namespace RetailCrm\ServiceBundle\Messenger\Middleware; -/** - * Interface LockableMessage - * - * @package RetailCrm\ServiceBundle\Messenger\Middleware - */ interface LockableMessage { public function __serialize(): array; diff --git a/Messenger/Middleware/LockableMessageMiddleware.php b/Messenger/Middleware/LockableMessageMiddleware.php index 0718567..512852f 100644 --- a/Messenger/Middleware/LockableMessageMiddleware.php +++ b/Messenger/Middleware/LockableMessageMiddleware.php @@ -9,29 +9,13 @@ use Symfony\Component\Messenger\Middleware\StackInterface; use Symfony\Component\Messenger\Stamp\ReceivedStamp; use Throwable; -/** - * Class LockableMessageMiddleware - * - * @package RetailCrm\ServiceBundle\Messenger\Middleware - */ class LockableMessageMiddleware implements MiddlewareInterface { - /** - * @var LockFactory - */ - private $lockFactory; - - public function __construct(LockFactory $lockFactory) + public function __construct(private LockFactory $lockFactory) { - $this->lockFactory = $lockFactory; } /** - * @param Envelope $envelope - * @param StackInterface $stack - * - * @return Envelope - * * @throws Throwable */ public function handle(Envelope $envelope, StackInterface $stack): Envelope @@ -56,11 +40,6 @@ class LockableMessageMiddleware implements MiddlewareInterface return $stack->next()->handle($envelope, $stack); } - /** - * @param LockableMessage $message - * - * @return string - */ private function objectHash(LockableMessage $message): string { return hash('crc32', serialize($message)); diff --git a/Models/Error.php b/Models/Error.php index ef6c462..ae63d87 100644 --- a/Models/Error.php +++ b/Models/Error.php @@ -2,25 +2,11 @@ namespace RetailCrm\ServiceBundle\Models; -/** - * Class Error - * - * @package RetailCrm\ServiceBundle\Models - */ class Error { - /** - * @var string - */ - public $code; + public string $code; - /** - * @var string - */ - public $message; + public string $message; - /** - * @var array - */ - public $details; + public array $details; } diff --git a/Response/ErrorJsonResponseFactory.php b/Response/ErrorJsonResponseFactory.php index 76bbcf5..f59e3c2 100644 --- a/Response/ErrorJsonResponseFactory.php +++ b/Response/ErrorJsonResponseFactory.php @@ -7,32 +7,12 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Serializer\SerializerInterface; -/** - * Class ErrorJsonResponseFactory - * - * @package RetailCrm\ServiceBundle\Response - */ class ErrorJsonResponseFactory { - private $serializer; - - /** - * ErrorJsonResponseFactory constructor. - * - * @param SerializerInterface $serializer - */ - public function __construct(SerializerInterface $serializer) + public function __construct(private SerializerInterface $serializer) { - $this->serializer = $serializer; } - /** - * @param Error $error - * @param int $statusCode - * @param array $headers - * - * @return Response - */ public function create(Error $error, int $statusCode = Response::HTTP_BAD_REQUEST, array $headers = []): Response { return JsonResponse::fromJsonString( diff --git a/Serializer/Adapter.php b/Serializer/Adapter.php index 5c797d4..701d0cb 100644 --- a/Serializer/Adapter.php +++ b/Serializer/Adapter.php @@ -2,28 +2,9 @@ namespace RetailCrm\ServiceBundle\Serializer; -/** - * Interface Adapter - * - * @package RetailCrm\ServiceBundle\Serializer - */ interface Adapter { - /** - * @param string $data - * @param string $type - * @param string $format - * - * @return object - */ public function deserialize(string $data, string $type, string $format = 'json'): object; - /** - * @param array $data - * @param string $type - * @param string|null $format - * - * @return object - */ public function arrayToObject(array $data, string $type, ?string $format = null): object; } diff --git a/Serializer/JMSSerializerAdapter.php b/Serializer/JMSSerializerAdapter.php index 6099e45..9e7947a 100644 --- a/Serializer/JMSSerializerAdapter.php +++ b/Serializer/JMSSerializerAdapter.php @@ -6,50 +6,26 @@ use JMS\Serializer\ArrayTransformerInterface; use JMS\Serializer\Context; use JMS\Serializer\SerializerInterface; -/** - * Class JMSSerializerAdapter - * - * @package RetailCrm\ServiceBundle\Serializer - */ class JMSSerializerAdapter implements Adapter { - private $serializer; - private $transformer; private $context; - /** - * JMSSerializerAdapter constructor. - * - * @param SerializerInterface $serializer - * @param ArrayTransformerInterface $transformer - */ public function __construct( - SerializerInterface $serializer, - ArrayTransformerInterface $transformer + private SerializerInterface $serializer, + private ArrayTransformerInterface $transformer ) { - $this->serializer = $serializer; - $this->transformer = $transformer; } - /** - * {@inheritdoc } - */ public function deserialize(string $data, string $type, string $format = 'json'): object { return $this->serializer->deserialize($data, $type, $format, $this->context); } - /** - * {@inheritdoc } - */ public function arrayToObject(array $data, string $type, ?string $format = null): object { return $this->transformer->fromArray($data, $type, $this->context); } - /** - * @param Context $context - */ public function setContext(Context $context): void { $this->context = $context; diff --git a/Serializer/SymfonySerializerAdapter.php b/Serializer/SymfonySerializerAdapter.php index fdb4a85..6140efa 100644 --- a/Serializer/SymfonySerializerAdapter.php +++ b/Serializer/SymfonySerializerAdapter.php @@ -5,48 +5,24 @@ namespace RetailCrm\ServiceBundle\Serializer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\SerializerInterface; -/** - * Class SymfonySerializerAdapter - * - * @package RetailCrm\ServiceBundle\Serializer - */ class SymfonySerializerAdapter implements Adapter { - private $serializer; - private $denormalizer; - private $context = []; + private array $context = []; - /** - * SymfonySerializerAdapter constructor. - * - * @param SerializerInterface $serializer - * @param DenormalizerInterface $denormalizer - */ - public function __construct(SerializerInterface $serializer, DenormalizerInterface $denormalizer) + public function __construct(private SerializerInterface $serializer, private DenormalizerInterface $denormalizer) { - $this->serializer = $serializer; - $this->denormalizer = $denormalizer; } - /** - * {@inheritdoc } - */ public function deserialize(string $data, string $type,string $format = 'json'): object { return $this->serializer->deserialize($data, $type, $format, $this->context); } - /** - * {@inheritdoc } - */ public function arrayToObject(array $data, string $type, string $format = null): object { return $this->denormalizer->denormalize($data, $type, $format, $this->context); } - /** - * @param array $context - */ public function setContext(array $context): void { $this->context = $context; diff --git a/Tests/DataFixtures/RequestDto.php b/Tests/DataFixtures/RequestDto.php index 84b16ba..0d68722 100644 --- a/Tests/DataFixtures/RequestDto.php +++ b/Tests/DataFixtures/RequestDto.php @@ -5,17 +5,11 @@ namespace RetailCrm\ServiceBundle\Tests\DataFixtures; use Symfony\Component\Validator\Constraints as Assert; use JMS\Serializer\Annotation as JMS; -/** - * Class RequestDto - * - * @package RetailCrm\ServiceBundle\Tests\DataFixtures - */ class RequestDto { /** - * @var string * @Assert\NotNull() * @JMS\Type("string") */ - public $param; + public string $param; } diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 1468dde..41a68ed 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -6,11 +6,6 @@ use PHPUnit\Framework\TestCase; use RetailCrm\ServiceBundle\DependencyInjection\Configuration; use Symfony\Component\Config\Definition\Processor; -/** - * Class ConfigurationTest - * - * @package RetailCrm\ServiceBundle\Tests\DependencyInjection - */ class ConfigurationTest extends TestCase { public function testConfig(): void diff --git a/Tests/DependencyInjection/RetailCrmServiceExtensionTest.php b/Tests/DependencyInjection/RetailCrmServiceExtensionTest.php index 75141e7..7c2ebaf 100644 --- a/Tests/DependencyInjection/RetailCrmServiceExtensionTest.php +++ b/Tests/DependencyInjection/RetailCrmServiceExtensionTest.php @@ -12,11 +12,6 @@ use RetailCrm\ServiceBundle\Security\FrontApiClientAuthenticator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -/** - * Class RetailCrmServiceExtensionTest - * - * @package RetailCrm\ServiceBundle\Tests\DependencyInjection - */ class RetailCrmServiceExtensionTest extends TestCase { private $container; diff --git a/Tests/Fixtures/App/Kernel.php b/Tests/Fixtures/App/Kernel.php index d10c683..9ee7229 100644 --- a/Tests/Fixtures/App/Kernel.php +++ b/Tests/Fixtures/App/Kernel.php @@ -3,21 +3,20 @@ namespace RetailCrm\ServiceBundle\Tests\Fixtures\App; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class Kernel extends \Symfony\Component\HttpKernel\Kernel { use MicroKernelTrait; - public function registerBundles() + public function registerBundles(): array { return [ new \Symfony\Bundle\FrameworkBundle\FrameworkBundle() ]; } - protected function configureContainer(ContainerBuilder $container/*, LoaderInterface $loader*/): void + protected function configureContainer(ContainerBuilder $container): void { $container ->register(TestCommand::class, TestCommand::class) @@ -26,8 +25,4 @@ class Kernel extends \Symfony\Component\HttpKernel\Kernel $container->setParameter('kernel.project_dir', __DIR__ . '/..'); } - -// public function registerContainerConfiguration(LoaderInterface $loader) -// { -// } } diff --git a/Tests/Messenger/CommandMessageTest.php b/Tests/Messenger/CommandMessageTest.php index fdd13b1..d982772 100644 --- a/Tests/Messenger/CommandMessageTest.php +++ b/Tests/Messenger/CommandMessageTest.php @@ -5,11 +5,6 @@ namespace RetailCrm\ServiceBundle\Tests\Messenger; use PHPUnit\Framework\TestCase; use RetailCrm\ServiceBundle\Tests\DataFixtures\TestMessage; -/** - * Class CommandMessageTest - * - * @package RetailCrm\ServiceBundle\Tests\Messenger - */ class CommandMessageTest extends TestCase { public function testMessage(): void diff --git a/Tests/Messenger/MessageHandler/InNewProcessRunnerTest.php b/Tests/Messenger/MessageHandler/InNewProcessRunnerTest.php index cada1a3..38b8507 100644 --- a/Tests/Messenger/MessageHandler/InNewProcessRunnerTest.php +++ b/Tests/Messenger/MessageHandler/InNewProcessRunnerTest.php @@ -7,11 +7,6 @@ use RetailCrm\ServiceBundle\Messenger\MessageHandler\InNewProcessRunner; use RetailCrm\ServiceBundle\Tests\Fixtures\App\TestCommandMessage; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -/** - * Class InNewProcessRunnerTest - * - * @package RetailCrm\ServiceBundle\Tests\Messenger\MessageHandler - */ class InNewProcessRunnerTest extends KernelTestCase { protected function setUp(): void diff --git a/Tests/Messenger/MessageHandler/SimpleConsoleRunnerTest.php b/Tests/Messenger/MessageHandler/SimpleConsoleRunnerTest.php index d5256b7..f279d52 100644 --- a/Tests/Messenger/MessageHandler/SimpleConsoleRunnerTest.php +++ b/Tests/Messenger/MessageHandler/SimpleConsoleRunnerTest.php @@ -7,11 +7,6 @@ use RetailCrm\ServiceBundle\Messenger\MessageHandler\SimpleConsoleRunner; use RetailCrm\ServiceBundle\Tests\Fixtures\App\TestCommandMessage; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -/** - * Class SimpleConsoleRunnerTest - * - * @package RetailCrm\ServiceBundle\Tests\Messenger\MessageHandler - */ class SimpleConsoleRunnerTest extends KernelTestCase { protected function setUp(): void diff --git a/Tests/Messenger/MessageHandlerTest.php b/Tests/Messenger/MessageHandlerTest.php index 1f66d97..0aba92c 100644 --- a/Tests/Messenger/MessageHandlerTest.php +++ b/Tests/Messenger/MessageHandlerTest.php @@ -7,11 +7,6 @@ use RetailCrm\ServiceBundle\Messenger\CommandMessage; use RetailCrm\ServiceBundle\Messenger\MessageHandler; use RetailCrm\ServiceBundle\Messenger\MessageHandler\JobRunner; -/** - * Class MessageHandlerTest - * - * @package RetailCrm\ServiceBundle\Tests\Messenger - */ class MessageHandlerTest extends TestCase { public function testRun(): void diff --git a/Tests/Messenger/Middleware/LockableMessageMiddlewareTest.php b/Tests/Messenger/Middleware/LockableMessageMiddlewareTest.php index ea74f78..69cc693 100644 --- a/Tests/Messenger/Middleware/LockableMessageMiddlewareTest.php +++ b/Tests/Messenger/Middleware/LockableMessageMiddlewareTest.php @@ -15,17 +15,9 @@ use Symfony\Component\Messenger\Middleware\MiddlewareInterface; use Symfony\Component\Messenger\Middleware\StackInterface; use Symfony\Component\Messenger\Stamp\ReceivedStamp; -/** - * Class LockableMessageMiddlewareTest - * - * @package RetailCrm\ServiceBundle\Tests\Messenger\Middleware - */ class LockableMessageMiddlewareTest extends TestCase { - /** - * @var LockFactory - */ - private $lockFactory; + private LockFactory $lockFactory; protected function setUp(): void { @@ -35,7 +27,7 @@ class LockableMessageMiddlewareTest extends TestCase public function testHandle(): void { $store = $this->createMock(PersistingStoreInterface::class); - $key = new Key(uniqid()); + $key = new Key(uniqid('', true)); $lock = new Lock($key, $store); $this->lockFactory->expects(static::once())->method('createLock')->willReturn($lock); $envelope = new Envelope(new TestMessage(), [new ReceivedStamp('test')]); @@ -55,7 +47,7 @@ class LockableMessageMiddlewareTest extends TestCase { $store = $this->createMock(PersistingStoreInterface::class); $store->method('save')->willThrowException(new LockConflictedException); - $key = new Key(uniqid()); + $key = new Key(uniqid('', true)); $lock = new Lock($key, $store); $this->lockFactory->expects(static::once())->method('createLock')->willReturn($lock); $envelope = new Envelope(new TestMessage(), [new ReceivedStamp('test')]); @@ -75,7 +67,7 @@ class LockableMessageMiddlewareTest extends TestCase { $store = $this->createMock(PersistingStoreInterface::class); $store->method('save')->willThrowException(new LockConflictedException); - $key = new Key(uniqid()); + $key = new Key(uniqid('', true)); $lock = new Lock($key, $store); $this->lockFactory->expects(static::never())->method('createLock')->willReturn($lock); $envelope = new Envelope(new \stdClass(), [new ReceivedStamp('test')]); @@ -95,7 +87,7 @@ class LockableMessageMiddlewareTest extends TestCase { $store = $this->createMock(PersistingStoreInterface::class); $store->method('save')->willThrowException(new LockConflictedException); - $key = new Key(uniqid()); + $key = new Key(uniqid('', true)); $lock = new Lock($key, $store); $this->lockFactory->expects(static::never())->method('createLock')->willReturn($lock); $envelope = new Envelope(new TestMessage()); diff --git a/Tests/Serializer/JMSSerializerAdapterTest.php b/Tests/Serializer/JMSSerializerAdapterTest.php index 1c7a1a4..9ea7e14 100644 --- a/Tests/Serializer/JMSSerializerAdapterTest.php +++ b/Tests/Serializer/JMSSerializerAdapterTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; use RetailCrm\ServiceBundle\Serializer\JMSSerializerAdapter; use RetailCrm\ServiceBundle\Tests\DataFixtures\RequestDto; -class JSMSerializerAdapterTest extends TestCase +class JMSSerializerAdapterTest extends TestCase { private $serializer; private $transformer;