diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5290670..4317b80 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -12,10 +12,10 @@ jobs: strategy: matrix: - php-version: ['7.4'] + php-version: ['8.1'] dependencies: [''] include: - - { php-version: '7.4', dependencies: '--prefer-lowest --prefer-stable' } + - { php-version: '8.1', dependencies: '--prefer-lowest --prefer-stable' } name: Unit tests - PHP ${{ matrix.dependencies }} @@ -65,7 +65,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: '8.1' extensions: json, mbstring - name: Install dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 9171654..d589aa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased +- [**BC**] Require php 8.1 ## 1.3.0 - 2022-04-05 - Add handled response type to profiler item diff --git a/composer.json b/composer.json index 1c20277..e2234c6 100644 --- a/composer.json +++ b/composer.json @@ -4,24 +4,25 @@ "license": "MIT", "type": "library", "require": { - "php": "^7.4", + "php": "^8.1", "ext-json": "*", "ext-mbstring": "*", - "lmc/cqrs-types": "^2.3", - "psr/cache": "^1.0", - "psr/http-message": "^1.0", - "ramsey/uuid": "^4.1", - "symfony/stopwatch": "^4.4 || ^5.0" + "lmc/cqrs-types": "^3.0", + "psr/cache": "^3.0", + "psr/http-message": "^1.0.1", + "ramsey/collection": "^1.2.2", + "ramsey/uuid": "^4.2.3", + "symfony/stopwatch": "^4.4 || ^5.0 || ^6.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.5", - "lmc/coding-standard": "^3.0", + "lmc/coding-standard": "^3.3", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^0.12.83", - "phpstan/phpstan-phpunit": "^0.12.18", - "phpunit/phpunit": "^9.5", - "symfony/cache": "^5.2" + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5.20", + "symfony/cache": "^5.2 || ^6.0" }, "autoload": { "psr-4": { @@ -36,8 +37,8 @@ "config": { "allow-plugins": { "phpstan/extension-installer": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "ergebnis/composer-normalize": true + "ergebnis/composer-normalize": true, + "dealerdirect/phpcodesniffer-composer-installer": true }, "sort-packages": true }, diff --git a/ecs.php b/ecs.php index 96528b8..c8355d4 100644 --- a/ecs.php +++ b/ecs.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Lmc\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff; -use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer; +use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symplify\EasyCodingStandard\ValueObject\Option; @@ -13,7 +13,10 @@ $parameters->set( Option::SKIP, - ['SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff.ReferencedGeneralException' => ['tests/Exception/*.php']] + [ + 'SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff.ReferencedGeneralException' => ['tests/Exception/*.php'], + BinaryOperatorSpacesFixer::class => null, + ], ); $containerConfigurator->import(__DIR__ . '/vendor/lmc/coding-standard/ecs.php'); @@ -26,6 +29,5 @@ $services->set(ClassNameSuffixByParentSniff::class) ->property('extraParentTypesToSuffixes', ['*ApplicatorInterface' => 'Applicator']); - $services->set(NoSuperfluousPhpdocTagsFixer::class) - ->call('configure', [['allow_mixed' => true]]); + $containerConfigurator->import(__DIR__ . '/vendor/lmc/coding-standard/ecs-8.1.php'); }; diff --git a/phpstan.neon b/phpstan.neon index db3f5d6..d44071d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,8 +1,17 @@ parameters: checkMissingIterableValueType: false - level: 7 + level: 8 paths: - src - tests/ ignoreErrors: + - + message: "#^Cannot call method getItem\\(\\) on Psr\\\\Cache\\\\CacheItemPoolInterface\\|null\\.$#" + count: 1 + path: src/QueryFetcher.php + + - + message: "#^Cannot call method save\\(\\) on Psr\\\\Cache\\\\CacheItemPoolInterface\\|null\\.$#" + count: 1 + path: src/QueryFetcher.php diff --git a/src/Command/ProfiledDataCommand.php b/src/Command/ProfiledDataCommand.php index c78d4e0..9d5bcdb 100644 --- a/src/Command/ProfiledDataCommand.php +++ b/src/Command/ProfiledDataCommand.php @@ -16,17 +16,13 @@ class ProfiledDataCommand implements CommandInterface, ProfileableInterface * @var callable */ private $createData; - private string $profilerId; - private ?array $profilerData; /** * @phpstan-param callable(): Data $createData */ - public function __construct(callable $createData, string $profilerId, ?array $profilerData = null) + public function __construct(callable $createData, private string $profilerId, private ?array $profilerData = null) { $this->createData = $createData; - $this->profilerId = $profilerId; - $this->profilerData = $profilerData; } final public function getRequestType(): string diff --git a/src/CommandSender.php b/src/CommandSender.php index fa5945e..3171741 100644 --- a/src/CommandSender.php +++ b/src/CommandSender.php @@ -24,13 +24,13 @@ * @phpstan-template DecodedResponse * * @phpstan-type Handler SendCommandHandlerInterface - * @phpstan-type Context SendContext + * @phpstan-type Context SendContext * * @phpstan-implements CommandSenderInterface */ class CommandSender implements CommandSenderInterface { - /** @phpstan-use CommonCQRSTrait */ + /** @phpstan-use CommonCQRSTrait */ use CommonCQRSTrait; /** @@ -68,7 +68,7 @@ class CommandSender implements CommandSenderInterface public function __construct( ?ProfilerBag $profilerBag, iterable $customHandlers = [], - iterable $customDecoders = [] + iterable $customDecoders = [], ) { $this->profilerBag = $profilerBag; @@ -146,12 +146,11 @@ public function send(CommandInterface $command, OnSuccessInterface $onSuccess, O * @phpstan-param ResponseDecoderInterface $decoder * @phpstan-param T $currentResponse * @phpstan-return U - * @param mixed $currentResponse */ private function getDecodedResponse( SendContext $context, ResponseDecoderInterface $decoder, - $currentResponse + mixed $currentResponse, ) { return $decoder->decode($currentResponse); } @@ -160,9 +159,8 @@ private function getDecodedResponse( * @phpstan-param CommandInterface $command * @phpstan-return DecodedResponse * @throws \Throwable - * @return mixed */ - public function sendAndReturn(CommandInterface $command) + public function sendAndReturn(CommandInterface $command): mixed { $response = null; @@ -171,7 +169,7 @@ public function sendAndReturn(CommandInterface $command) new OnSuccessCallback(function ($decodedResponse) use (&$response): void { $response = $decodedResponse; }), - OnErrorCallback::throwOnError() + OnErrorCallback::throwOnError(), ); return $response; @@ -181,7 +179,7 @@ private function iterateHandlers(): array { return array_map( fn (PrioritizedItem $PrioritizedItem) => $PrioritizedItem->getItem(), - $this->handlers + $this->handlers, ); } @@ -198,8 +196,8 @@ private function startProfileCommand(ProfileableInterface $command, SendContext $command->getProfilerId(), $command->getProfilerData(), ProfilerItem::TYPE_COMMAND, - get_class($command) - ) + get_class($command), + ), ); $context->startStopwatch(); @@ -219,7 +217,7 @@ private function profileCommandFinished(SendContext $context): void $profilerItem->setHandledBy(sprintf( '%s<%s>', Utils::getType($currentHandler), - $context->getHandledResponseType() + $context->getHandledResponseType(), )); $profilerItem->setDecodedBy($context->getUsedDecoders()); diff --git a/src/Core/AbstractContext.php b/src/Core/AbstractContext.php index 210ff2e..15efee9 100644 --- a/src/Core/AbstractContext.php +++ b/src/Core/AbstractContext.php @@ -4,7 +4,9 @@ use Lmc\Cqrs\Types\CommandInterface; use Lmc\Cqrs\Types\Decoder\ResponseDecoderInterface; +use Lmc\Cqrs\Types\QueryHandlerInterface; use Lmc\Cqrs\Types\QueryInterface; +use Lmc\Cqrs\Types\SendCommandHandlerInterface; use Lmc\Cqrs\Types\Utils; use Lmc\Cqrs\Types\ValueObject\ProfilerItem; use Ramsey\Uuid\Uuid; @@ -14,22 +16,18 @@ /** * @internal * - * @phpstan-template Initiator - * @phpstan-template Handler + * @phpstan-template Request * @phpstan-template Response */ abstract class AbstractContext { private UuidInterface $key; - /** - * @phpstan-var Initiator - * @var QueryInterface|CommandInterface - */ - private $initiator; + /** @phpstan-var QueryInterface|CommandInterface */ + private QueryInterface|CommandInterface $initiator; private bool $isHandled = false; - /** @phpstan-var Handler|null */ - private $usedHandler; + /** @phpstan-var QueryHandlerInterface|SendCommandHandlerInterface|null */ + private QueryHandlerInterface|SendCommandHandlerInterface|null $usedHandler; private ?string $handledResponseType = null; /** @var string[] */ @@ -38,27 +36,18 @@ abstract class AbstractContext private ?Stopwatch $stopwatch = null; private ?\Throwable $error = null; - /** - * @phpstan-var ?Response - * @var ?mixed - */ - private $response; + /** @phpstan-var ?Response */ + private mixed $response = null; - /** - * @phpstan-param Initiator $initiator - * @param QueryInterface|CommandInterface $initiator - */ - public function __construct($initiator) + /** @phpstan-param QueryInterface|CommandInterface $initiator */ + public function __construct(QueryInterface|CommandInterface $initiator) { $this->initiator = $initiator; $this->key = Uuid::uuid4(); } - /** - * @phpstan-return Initiator - * @return QueryInterface|CommandInterface - */ - public function getInitiator() + /** @phpstan-return QueryInterface|CommandInterface */ + public function getInitiator(): QueryInterface|CommandInterface { return $this->initiator; } @@ -92,20 +81,14 @@ public function isHandled(): bool return $this->isHandled; } - /** - * @phpstan-param Handler|null $usedHandler - * @param mixed $usedHandler - */ - public function setUsedHandler($usedHandler): void + /** @phpstan-param QueryHandlerInterface|SendCommandHandlerInterface|null $usedHandler */ + public function setUsedHandler(QueryHandlerInterface|SendCommandHandlerInterface|null $usedHandler): void { $this->usedHandler = $usedHandler; } - /** - * @phpstan-return Handler|null - * @return mixed - */ - public function getUsedHandler() + /** @phpstan-return QueryHandlerInterface|SendCommandHandlerInterface|null */ + public function getUsedHandler(): QueryHandlerInterface|SendCommandHandlerInterface|null { return $this->usedHandler; } @@ -120,20 +103,14 @@ public function getHandledResponseType(): ?string return $this->handledResponseType; } - /** - * @phpstan-param ?Response $response - * @param ?mixed $response - */ - public function setResponse($response): void + /** @phpstan-param ?Response $response */ + public function setResponse(mixed $response): void { $this->response = $response; } - /** - * @phpstan-return ?Response - * @return ?mixed - */ - public function getResponse() + /** @phpstan-return ?Response */ + public function getResponse(): mixed { return $this->response; } @@ -155,16 +132,14 @@ public function getError(): ?\Throwable * @phpstan-param ResponseDecoderInterface $decoder * @phpstan-param T $currentResponse * @phpstan-param U $decodedResponse - * @param mixed $currentResponse - * @param mixed $decodedResponse */ - public function addUsedDecoder(ResponseDecoderInterface $decoder, $currentResponse, $decodedResponse): void + public function addUsedDecoder(ResponseDecoderInterface $decoder, mixed $currentResponse, mixed $decodedResponse): void { $this->usedDecoders[] = sprintf( '%s<%s, %s>', get_class($decoder), Utils::getType($currentResponse), - Utils::getType($decodedResponse) + Utils::getType($decodedResponse), ); } diff --git a/src/Core/CommonCQRSTrait.php b/src/Core/CommonCQRSTrait.php index 1bd803c..19cd0b3 100644 --- a/src/Core/CommonCQRSTrait.php +++ b/src/Core/CommonCQRSTrait.php @@ -4,6 +4,8 @@ use Lmc\Cqrs\Handler\ProfilerBag; use Lmc\Cqrs\Types\Decoder\ResponseDecoderInterface; +use Lmc\Cqrs\Types\QueryHandlerInterface; +use Lmc\Cqrs\Types\SendCommandHandlerInterface; use Lmc\Cqrs\Types\Utils; use Lmc\Cqrs\Types\ValueObject\DecodedValueInterface; use Lmc\Cqrs\Types\ValueObject\PrioritizedItem; @@ -12,6 +14,9 @@ /** * @internal * + * @phpstan-template Request + * @phpstan-template Response + * * @phpstan-template Context * @phpstan-template Handler */ @@ -70,12 +75,10 @@ public function getDecoders(): array } /** - * @phpstan-param Handler $handler + * @phpstan-param QueryHandlerInterface|SendCommandHandlerInterface $handler * @phpstan-param Context $context - * @param mixed $handler - * @param mixed $response */ - private function setIsHandled($handler, AbstractContext $context, $response = null): void + private function setIsHandled(QueryHandlerInterface|SendCommandHandlerInterface $handler, AbstractContext $context, mixed $response = null): void { $context->setIsHandled(true); diff --git a/src/Core/FetchContext.php b/src/Core/FetchContext.php index 2a28d49..6b2b043 100644 --- a/src/Core/FetchContext.php +++ b/src/Core/FetchContext.php @@ -8,9 +8,8 @@ * @internal * * @phpstan-template Request - * @phpstan-template Handler - * @phpstan-template DecodedResponse - * @phpstan-extends AbstractContext, Handler, DecodedResponse> + * @phpstan-template Response + * @phpstan-extends AbstractContext */ class FetchContext extends AbstractContext { diff --git a/src/Core/SendContext.php b/src/Core/SendContext.php index 9888170..9e9dce8 100644 --- a/src/Core/SendContext.php +++ b/src/Core/SendContext.php @@ -8,9 +8,8 @@ * @internal * * @phpstan-template Request - * @phpstan-template Handler - * @phpstan-template DecodedResponse - * @phpstan-extends AbstractContext, Handler, DecodedResponse> + * @phpstan-template Response + * @phpstan-extends AbstractContext */ class SendContext extends AbstractContext { diff --git a/src/Handler/GetCachedHandler.php b/src/Handler/GetCachedHandler.php index 9b28501..464727e 100644 --- a/src/Handler/GetCachedHandler.php +++ b/src/Handler/GetCachedHandler.php @@ -16,11 +16,8 @@ */ class GetCachedHandler extends AbstractQueryHandler { - private CacheItemPoolInterface $cache; - - public function __construct(CacheItemPoolInterface $cache) + public function __construct(private CacheItemPoolInterface $cache) { - $this->cache = $cache; } /** @phpstan-param QueryInterface $query */ diff --git a/src/ProfilerBag.php b/src/ProfilerBag.php index 7f99dbd..8a318c7 100644 --- a/src/ProfilerBag.php +++ b/src/ProfilerBag.php @@ -43,8 +43,8 @@ public function getBag(): array return $this->bag; } - /** @return iterable */ - public function getIterator(): iterable + /** @phpstan-return \Traversable */ + public function getIterator(): \Traversable { yield from $this->bag; } diff --git a/src/Query/CachedDataQuery.php b/src/Query/CachedDataQuery.php index ca37a99..85a80cc 100644 --- a/src/Query/CachedDataQuery.php +++ b/src/Query/CachedDataQuery.php @@ -18,17 +18,13 @@ class CachedDataQuery implements QueryInterface, CacheableInterface * @var callable */ private $createData; - private CacheKey $cacheKey; - private CacheTime $cacheTime; /** * @phpstan-param callable(): Data $createData */ - public function __construct(callable $createData, CacheKey $cacheKey, CacheTime $cacheTime) + public function __construct(callable $createData, private CacheKey $cacheKey, private CacheTime $cacheTime) { $this->createData = $createData; - $this->cacheKey = $cacheKey; - $this->cacheTime = $cacheTime; } final public function getRequestType(): string diff --git a/src/Query/ProfiledCachedDataQuery.php b/src/Query/ProfiledCachedDataQuery.php index 0beb682..1f1de16 100644 --- a/src/Query/ProfiledCachedDataQuery.php +++ b/src/Query/ProfiledCachedDataQuery.php @@ -12,9 +12,6 @@ */ class ProfiledCachedDataQuery extends CachedDataQuery implements ProfileableInterface { - private string $profilerId; - private ?array $profilerData; - /** * @phpstan-param callable(): Data $createData */ @@ -22,12 +19,10 @@ public function __construct( callable $createData, CacheKey $cacheKey, CacheTime $cacheTime, - string $profilerId, - ?array $profilerData = null + private string $profilerId, + private ?array $profilerData = null, ) { parent::__construct($createData, $cacheKey, $cacheTime); - $this->profilerId = $profilerId; - $this->profilerData = $profilerData; } public function getProfilerId(): string diff --git a/src/QueryFetcher.php b/src/QueryFetcher.php index 82df826..a05f0f8 100644 --- a/src/QueryFetcher.php +++ b/src/QueryFetcher.php @@ -28,13 +28,13 @@ * @phpstan-template DecodedResponse * * @phpstan-type Handler QueryHandlerInterface - * @phpstan-type Context FetchContext + * @phpstan-type Context FetchContext * * @phpstan-implements QueryFetcherInterface */ class QueryFetcher implements QueryFetcherInterface { - /** @phpstan-use CommonCQRSTrait */ + /** @phpstan-use CommonCQRSTrait */ use CommonCQRSTrait; /** @@ -43,9 +43,6 @@ class QueryFetcher implements QueryFetcherInterface */ private array $handlers = []; - private bool $isCacheEnabled; - private ?CacheItemPoolInterface $cache; - /** * Custom Handler(s) priority defaults to 50 (medium) * @@ -73,18 +70,16 @@ class QueryFetcher implements QueryFetcherInterface * @see PrioritizedItem::PRIORITY_MEDIUM */ public function __construct( - bool $isCacheEnabled, - ?CacheItemPoolInterface $cache, + private bool $isCacheEnabled, + private ?CacheItemPoolInterface $cache, ?ProfilerBag $profilerBag, iterable $customHandlers = [], - iterable $customDecoders = [] + iterable $customDecoders = [], ) { if ($isCacheEnabled && $cache === null) { throw new \InvalidArgumentException('Cache pool must be set if cache is enabled.'); } - $this->isCacheEnabled = $isCacheEnabled; - $this->cache = $cache; $this->profilerBag = $profilerBag; $this->register($customHandlers, [$this, 'addHandler']); @@ -120,7 +115,7 @@ private function fetchResponse( QueryInterface $query, OnSuccessInterface $onSuccess, OnErrorInterface $onError, - callable $filter = null + callable $filter = null, ): void { $context = new FetchContext($query); @@ -188,9 +183,8 @@ private function fetchResponse( * @phpstan-param QueryInterface $query * @phpstan-return DecodedResponse * @throws \Throwable - * @return mixed */ - public function fetchAndReturn(QueryInterface $query) + public function fetchAndReturn(QueryInterface $query): mixed { return $this->fetchAndReturnQuery($query, [$this, 'fetch']); } @@ -199,9 +193,8 @@ public function fetchAndReturn(QueryInterface $query) * @phpstan-param QueryInterface $query * @phpstan-return DecodedResponse * @throws \Throwable - * @return mixed */ - public function fetchFreshAndReturn(QueryInterface $query) + public function fetchFreshAndReturn(QueryInterface $query): mixed { return $this->fetchAndReturnQuery($query, [$this, 'fetchFresh']); } @@ -210,9 +203,8 @@ public function fetchFreshAndReturn(QueryInterface $query) * @phpstan-param QueryInterface $query * @phpstan-return DecodedResponse * @throws \Throwable - * @return mixed */ - private function fetchAndReturnQuery(QueryInterface $query, callable $fetch) + private function fetchAndReturnQuery(QueryInterface $query, callable $fetch): mixed { $response = null; @@ -221,7 +213,7 @@ private function fetchAndReturnQuery(QueryInterface $query, callable $fetch) new OnSuccessCallback(function ($decodedResponse) use (&$response): void { $response = $decodedResponse; }), - OnErrorCallback::throwOnError() + OnErrorCallback::throwOnError(), ); return $response; @@ -231,7 +223,7 @@ private function iterateHandlers(callable $filter = null): array { $handlers = array_map( fn (PrioritizedItem $PrioritizedItem) => $PrioritizedItem->getItem(), - $this->handlers + $this->handlers, ); return $filter @@ -249,7 +241,7 @@ private function startProfileQuery(ProfileableInterface $query, FetchContext $co $query->getProfilerId(), $query->getProfilerData(), ProfilerItem::TYPE_QUERY, - get_class($query) + get_class($query), ); if ($query instanceof CacheableInterface) { @@ -271,12 +263,11 @@ private function startProfileQuery(ProfileableInterface $query, FetchContext $co * @phpstan-param ResponseDecoderInterface $decoder * @phpstan-param T $currentResponse * @phpstan-return U - * @param mixed $currentResponse */ private function getDecodedResponse( FetchContext $context, ResponseDecoderInterface $decoder, - $currentResponse + mixed $currentResponse, ) { $query = $context->getInitiator(); @@ -307,9 +298,8 @@ private function shouldCacheResponse(FetchContext $context): bool /** * @phpstan-param Context $context - * @param mixed $response */ - private function cacheSuccess(CacheableInterface $query, FetchContext $context, $response): void + private function cacheSuccess(CacheableInterface $query, FetchContext $context, mixed $response): void { if ($this->cache && $this->isCacheEnabled() @@ -347,7 +337,7 @@ private function profileQueryFinished(FetchContext $context): void $profilerItem->setHandledBy(sprintf( '%s<%s>', Utils::getType($currentHandler), - $context->getHandledResponseType() + $context->getHandledResponseType(), )); $profilerItem->setDecodedBy($context->getUsedDecoders()); diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 8c70ecf..e4f8332 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -23,7 +23,7 @@ protected function assertLastHandledBy(string $expectedHandlerClass, string $exp $this->assertHandledBy($expectedHandlerClass, $expectedResponseType, $lastProfilerItem->getHandledBy()); } - protected function assertHandledBy(string $expectedHandlerClass, string $expectedResponseType, string $actual): void + protected function assertHandledBy(string $expectedHandlerClass, string $expectedResponseType, ?string $actual): void { $expected = sprintf('%s<%s>', $expectedHandlerClass, $expectedResponseType); diff --git a/tests/CommandSenderTest.php b/tests/CommandSenderTest.php index 71d0586..b1b16ec 100644 --- a/tests/CommandSenderTest.php +++ b/tests/CommandSenderTest.php @@ -48,7 +48,7 @@ public function shouldSendCommand(): void $this->commandSender->send( $dummyCommand, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); } @@ -68,7 +68,7 @@ public function shouldProfileGivenCommand(): void $this->commandSender->send( new ProfileableCommandAdapter($dummyCommand, $profilerId, ['body' => $commandBody]), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(1, $this->profilerBag); @@ -98,7 +98,7 @@ public function shouldNotProfileNotProfileableCommand(): void $this->commandSender->send( $dummyCommand, new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(0, $this->profilerBag); @@ -115,7 +115,7 @@ public function shouldNotProfileWithoutProfilerBag(): void $this->commandSenderWithoutFeatures->send( new ProfileableCommandAdapter($dummyCommand, $profilerId), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(0, $this->profilerBag); @@ -184,7 +184,7 @@ public function shouldSendCommandDecodeResponseAndProfileIt(): void $this->assertCount(0, $this->profilerBag); $decodedResponse = $this->commandSender->sendAndReturn( - new ProfileableCommandAdapter($dummyCommand, $profilerId, ['body' => $commandBody]) + new ProfileableCommandAdapter($dummyCommand, $profilerId, ['body' => $commandBody]), ); $this->assertSame('fresh-data', $decodedResponse); @@ -237,7 +237,7 @@ public function prepare(CommandInterface $command): CommandInterface public function handle( CommandInterface $command, OnSuccessInterface $onSuccess, - OnErrorInterface $onError + OnErrorInterface $onError, ): void { throw new \Exception(sprintf('Method %s should not be called.', __METHOD__)); } @@ -297,7 +297,7 @@ public function shouldSendCommandAndUseMultipleDecoders(): void 'Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder', 'Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder', ], - $item->getDecodedBy() + $item->getDecodedBy(), ); } } @@ -350,7 +350,7 @@ public function shouldSendCommandAndUseOnlyOneDecoder(): void $this->assertHandledBy(DummySendCommandHandler::class, 'string', $item->getHandledBy()); $this->assertSame( ['Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder>'], - $item->getDecodedBy() + $item->getDecodedBy(), ); } } @@ -394,7 +394,7 @@ public function shouldSendConsequentCommand(): void public function shouldUseProfilerBagVerbosity( string $verbosity, bool $withDecoder, - array $expectedAdditionalData + array $expectedAdditionalData, ): void { $this->profilerBag->setVerbosity($verbosity); @@ -419,7 +419,7 @@ public function shouldUseProfilerBagVerbosity( $this->assertCount(0, $this->profilerBag); $decodedResponse = $this->commandSender->sendAndReturn( - new ProfileableCommandAdapter($dummyCommand, $profilerId, ['body' => $commandBody]) + new ProfileableCommandAdapter($dummyCommand, $profilerId, ['body' => $commandBody]), ); $this->assertSame($expectedResponse, $decodedResponse); diff --git a/tests/Fixture/CacheableProfileableQueryAdapter.php b/tests/Fixture/CacheableProfileableQueryAdapter.php index 5ef5e93..d932b8f 100644 --- a/tests/Fixture/CacheableProfileableQueryAdapter.php +++ b/tests/Fixture/CacheableProfileableQueryAdapter.php @@ -14,27 +14,14 @@ */ class CacheableProfileableQueryAdapter implements QueryInterface, CacheableInterface, ProfileableInterface { - /** @phpstan-var QueryInterface */ - private QueryInterface $query; - - private CacheKey $cacheKey; - private CacheTime $cacheTime; - private string $profileId; - private ?array $profileData; - /** @phpstan-param QueryInterface $query */ public function __construct( - QueryInterface $query, - CacheKey $cacheKey, - CacheTime $cacheTime, - string $profileId, - ?array $profileData = null + private QueryInterface $query, + private CacheKey $cacheKey, + private CacheTime $cacheTime, + private string $profileId, + private ?array $profileData = null, ) { - $this->query = $query; - $this->cacheKey = $cacheKey; - $this->cacheTime = $cacheTime; - $this->profileId = $profileId; - $this->profileData = $profileData; } public function getCacheKey(): CacheKey @@ -52,7 +39,7 @@ public function getRequestType(): string return $this->query->getRequestType(); } - public function createRequest() + public function createRequest(): mixed { return $this->query->createRequest(); } diff --git a/tests/Fixture/CacheableQueryAdapter.php b/tests/Fixture/CacheableQueryAdapter.php index a108427..d7d0ee1 100644 --- a/tests/Fixture/CacheableQueryAdapter.php +++ b/tests/Fixture/CacheableQueryAdapter.php @@ -13,18 +13,12 @@ */ class CacheableQueryAdapter implements QueryInterface, CacheableInterface { - /** @phpstan-var QueryInterface */ - private QueryInterface $query; - - private CacheKey $cacheKey; - private CacheTime $cacheTime; - /** @phpstan-param QueryInterface $query */ - public function __construct(QueryInterface $query, CacheKey $cacheKey, CacheTime $cacheTime) - { - $this->query = $query; - $this->cacheKey = $cacheKey; - $this->cacheTime = $cacheTime; + public function __construct( + private QueryInterface $query, + private CacheKey $cacheKey, + private CacheTime $cacheTime, + ) { } public function getCacheKey(): CacheKey @@ -42,7 +36,7 @@ public function getRequestType(): string return $this->query->getRequestType(); } - public function createRequest() + public function createRequest(): mixed { return $this->query->createRequest(); } diff --git a/tests/Fixture/DummyCommand.php b/tests/Fixture/DummyCommand.php index db73141..ae64b2c 100644 --- a/tests/Fixture/DummyCommand.php +++ b/tests/Fixture/DummyCommand.php @@ -9,11 +9,8 @@ */ class DummyCommand implements CommandInterface { - private string $response; - - public function __construct(string $response) + public function __construct(private string $response) { - $this->response = $response; } public function getRequestType(): string diff --git a/tests/Fixture/DummyQuery.php b/tests/Fixture/DummyQuery.php index d23609d..d540e39 100644 --- a/tests/Fixture/DummyQuery.php +++ b/tests/Fixture/DummyQuery.php @@ -9,11 +9,8 @@ */ class DummyQuery implements QueryInterface { - private string $response; - - public function __construct(string $response) + public function __construct(private string $response) { - $this->response = $response; } public function getRequestType(): string diff --git a/tests/Fixture/ImpureTranslationDecoder.php b/tests/Fixture/ImpureTranslationDecoder.php index 3136192..ce9fb78 100644 --- a/tests/Fixture/ImpureTranslationDecoder.php +++ b/tests/Fixture/ImpureTranslationDecoder.php @@ -7,11 +7,8 @@ /** @phpstan-implements ImpureResponseDecoderInterface */ class ImpureTranslationDecoder implements ImpureResponseDecoderInterface { - private string $language; - - public function __construct(string $language) + public function __construct(private string $language) { - $this->language = $language; } public function changeLanguage(string $language): void @@ -19,12 +16,12 @@ public function changeLanguage(string $language): void $this->language = $language; } - public function supports($response, $initiator): bool + public function supports(mixed $response, mixed $initiator): bool { return is_string($response); } - public function decode($response) + public function decode(mixed $response): mixed { return sprintf('translated[%s]: %s', $this->language, $response); } diff --git a/tests/Fixture/ProfileableCommandAdapter.php b/tests/Fixture/ProfileableCommandAdapter.php index 950305f..1554a4c 100644 --- a/tests/Fixture/ProfileableCommandAdapter.php +++ b/tests/Fixture/ProfileableCommandAdapter.php @@ -11,17 +11,12 @@ */ class ProfileableCommandAdapter implements CommandInterface, ProfileableInterface { - /** @phpstan-var CommandInterface */ - private CommandInterface $command; - private string $profilerKey; - private ?array $profilerData; - /** @phpstan-param CommandInterface $command */ - public function __construct(CommandInterface $command, string $profilerKey, ?array $profilerData = null) - { - $this->command = $command; - $this->profilerKey = $profilerKey; - $this->profilerData = $profilerData; + public function __construct( + private CommandInterface $command, + private string $profilerKey, + private ?array $profilerData = null, + ) { } public function getProfilerId(): string @@ -39,7 +34,7 @@ public function getRequestType(): string return $this->command->getRequestType(); } - public function createRequest() + public function createRequest(): mixed { return $this->command->createRequest(); } diff --git a/tests/Fixture/ProfileableQueryAdapter.php b/tests/Fixture/ProfileableQueryAdapter.php index 416d852..51fa4c6 100644 --- a/tests/Fixture/ProfileableQueryAdapter.php +++ b/tests/Fixture/ProfileableQueryAdapter.php @@ -11,17 +11,12 @@ */ class ProfileableQueryAdapter implements QueryInterface, ProfileableInterface { - /** @phpstan-var QueryInterface */ - private QueryInterface $query; - private string $profilerKey; - private ?array $profilerData; - /** @phpstan-param QueryInterface $query */ - public function __construct(QueryInterface $query, string $profilerKey, ?array $profilerData = null) - { - $this->query = $query; - $this->profilerKey = $profilerKey; - $this->profilerData = $profilerData; + public function __construct( + private QueryInterface $query, + private string $profilerKey, + private ?array $profilerData = null, + ) { } public function getProfilerId(): string @@ -39,7 +34,7 @@ public function getRequestType(): string return $this->query->getRequestType(); } - public function createRequest() + public function createRequest(): mixed { return $this->query->createRequest(); } diff --git a/tests/Handler/CallbackQueryHandlerTest.php b/tests/Handler/CallbackQueryHandlerTest.php index 483171e..acaf740 100644 --- a/tests/Handler/CallbackQueryHandlerTest.php +++ b/tests/Handler/CallbackQueryHandlerTest.php @@ -34,17 +34,16 @@ public function shouldSupportCallableQuery(QueryInterface $query): void /** * @param QueryInterface $query - * @param mixed $expectedResult * * @dataProvider provideCallableQuery * @test */ - public function shouldHandleCallableQuery(QueryInterface $query, $expectedResult): void + public function shouldHandleCallableQuery(QueryInterface $query, mixed $expectedResult): void { $this->handler->handle( $query, new OnSuccessCallback(fn ($data) => $this->assertSame($expectedResult, $data)), - new OnErrorCallback(fn (\Throwable $e) => $this->fail($e->getMessage())) + new OnErrorCallback(fn (\Throwable $e) => $this->fail($e->getMessage())), ); } diff --git a/tests/Handler/CallbackSendCommandHandlerTest.php b/tests/Handler/CallbackSendCommandHandlerTest.php index 136b94a..e214064 100644 --- a/tests/Handler/CallbackSendCommandHandlerTest.php +++ b/tests/Handler/CallbackSendCommandHandlerTest.php @@ -31,17 +31,16 @@ public function shouldSupportCallableCommand(CommandInterface $command): void /** * @param CommandInterface $command - * @param mixed $expectedResult * * @dataProvider provideCallableCommand * @test */ - public function shouldHandleCallableCommand(CommandInterface $command, $expectedResult): void + public function shouldHandleCallableCommand(CommandInterface $command, mixed $expectedResult): void { $this->handler->handle( $command, new OnSuccessCallback(fn ($data) => $this->assertSame($expectedResult, $data)), - new OnErrorCallback(fn (\Throwable $e) => $this->fail($e->getMessage())) + new OnErrorCallback(fn (\Throwable $e) => $this->fail($e->getMessage())), ); } diff --git a/tests/QueryFetcherTest.php b/tests/QueryFetcherTest.php index d8f4c02..3df54a7 100644 --- a/tests/QueryFetcherTest.php +++ b/tests/QueryFetcherTest.php @@ -75,7 +75,7 @@ public function shouldNotFetchNotCacheableQueryFromCache(): void new OnErrorCallback(function (\Throwable $error): void { $this->assertInstanceOf(CqrsExceptionInterface::class, $error); $this->assertInstanceOf(NoQueryHandlerUsedException::class, $error); - }) + }), ); } @@ -94,7 +94,7 @@ public function shouldFetchQueryDataFromCache(): void $this->queryFetcher->fetch( new CacheableQueryAdapter($dummyQuery, $key, CacheTime::oneMinute()), new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); } @@ -110,7 +110,7 @@ public function shouldFetchQueryDataByHandler(): void $this->queryFetcher->fetch( $dummyQuery, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); } @@ -131,7 +131,7 @@ public function shouldFetchQueryDataFromCacheAndNotByHandler(): void $this->queryFetcher->fetch( new CacheableQueryAdapter($dummyQuery, $key, CacheTime::oneMinute()), new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); } @@ -152,7 +152,7 @@ public function shouldFetchQueryDataFromHandlerWithHigherPriorityAndCacheThem(): $this->queryFetcher->fetch( new CacheableQueryAdapter($dummyQuery, $key, CacheTime::oneMinute()), new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $item = $this->cache->getItem($key->getHashedKey()); @@ -177,7 +177,7 @@ public function shouldFetchFreshQueryDataAndCacheThem(): void $this->queryFetcher->fetchFresh( new CacheableQueryAdapter($dummyQuery, $key, CacheTime::oneMinute()), new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $item = $this->cache->getItem($key->getHashedKey()); @@ -203,7 +203,7 @@ public function shouldNotFetchQueryDataWithNoCacheGiven(): void new OnErrorCallback(function (\Throwable $error): void { $this->assertInstanceOf(CqrsExceptionInterface::class, $error); $this->assertInstanceOf(NoQueryHandlerUsedException::class, $error); - }) + }), ); } @@ -223,7 +223,7 @@ public function shouldNotFetchQueryDataWithNoItemInCache(): void new OnErrorCallback(function (\Throwable $error): void { $this->assertInstanceOf(CqrsExceptionInterface::class, $error); $this->assertInstanceOf(NoQueryHandlerUsedException::class, $error); - }) + }), ); } @@ -247,7 +247,7 @@ public function shouldNotFetchExpiredData(): void new OnErrorCallback(function (\Throwable $error): void { $this->assertInstanceOf(CqrsExceptionInterface::class, $error); $this->assertInstanceOf(NoQueryHandlerUsedException::class, $error); - }) + }), ); } @@ -271,7 +271,7 @@ public function shouldNotFetchCachedDataFromCacheWithNoCacheTime(): void new OnErrorCallback(function (\Throwable $error): void { $this->assertInstanceOf(CqrsExceptionInterface::class, $error); $this->assertInstanceOf(NoQueryHandlerUsedException::class, $error); - }) + }), ); } @@ -292,7 +292,7 @@ public function shouldNotFetchCachedDataFromCacheWithDisabledCacheAndDontChangeT $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->queryFetcher->disableCache(); @@ -301,7 +301,7 @@ public function shouldNotFetchCachedDataFromCacheWithDisabledCacheAndDontChangeT $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->queryFetcher->enableCache(); @@ -310,7 +310,7 @@ public function shouldNotFetchCachedDataFromCacheWithDisabledCacheAndDontChangeT $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); } @@ -331,14 +331,14 @@ public function shouldInvalidateCachedItemByQuery(): void new DummyQuery('fresh-data'), $key, CacheTime::oneMinute(), - $profilerId + $profilerId, ); // fetch from cache $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(GetCachedHandler::class, 'string', $this->profilerBag->getBag()); @@ -349,7 +349,7 @@ public function shouldInvalidateCachedItemByQuery(): void $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(DummyQueryHandler::class, 'string', $this->profilerBag->getBag()); @@ -357,7 +357,7 @@ public function shouldInvalidateCachedItemByQuery(): void $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(GetCachedHandler::class, 'string', $this->profilerBag->getBag()); @@ -381,14 +381,14 @@ public function shouldInvalidateCachedItemByHashedKey(): void new DummyQuery('fresh-data'), $key, CacheTime::oneMinute(), - $profilerId + $profilerId, ); // fetch from cache $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame($cachedValue, $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(GetCachedHandler::class, 'string', $this->profilerBag->getBag()); @@ -399,7 +399,7 @@ public function shouldInvalidateCachedItemByHashedKey(): void $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(DummyQueryHandler::class, 'string', $this->profilerBag->getBag()); @@ -407,7 +407,7 @@ public function shouldInvalidateCachedItemByHashedKey(): void $this->queryFetcher->fetch( $query, new OnSuccessCallback(fn ($data) => $this->assertSame('fresh-data', $data)), - new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())) + new OnErrorCallback(fn (\Throwable $error) => $this->fail($error->getMessage())), ); $this->assertLastHandledBy(GetCachedHandler::class, 'string', $this->profilerBag->getBag()); @@ -438,7 +438,7 @@ public function shouldProfileGivenQuery(): void $this->queryFetcher->fetch( new ProfileableQueryAdapter($dummyQuery, $profilerId), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(1, $this->profilerBag); @@ -478,7 +478,7 @@ public function shouldProfileGivenCacheableQuery(): void $profilerId, ), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(1, $this->profilerBag); @@ -522,7 +522,7 @@ public function shouldProfileGivenCacheableQueryFetchedFromCache(): void $profilerId, ), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(1, $this->profilerBag); @@ -552,7 +552,7 @@ public function shouldNotProfileNotProfileableQuery(): void $this->queryFetcher->fetch( $dummyQuery, new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(0, $this->profilerBag); @@ -569,7 +569,7 @@ public function shouldNotProfileWithoutProfilerBag(): void $this->queryFetcherWithoutFeatures->fetch( new ProfileableQueryAdapter($dummyQuery, $profilerId), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(0, $this->profilerBag); @@ -641,7 +641,7 @@ public function shouldFetchFromCacheAndDecodeQueryAndProfileIt(): void new DummyQuery('fresh-data'), $key, CacheTime::oneMinute(), - $profilerId + $profilerId, ); $decoder = new CallbackResponseDecoder( @@ -669,7 +669,7 @@ public function shouldFetchFromCacheAndDecodeQueryAndProfileIt(): void $this->assertHandledBy(GetCachedHandler::class, 'string', $item->getHandledBy()); $this->assertSame( ['Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder'], - $item->getDecodedBy() + $item->getDecodedBy(), ); } } @@ -726,7 +726,7 @@ public function prepare(QueryInterface $query): QueryInterface public function handle( QueryInterface $query, OnSuccessInterface $onSuccess, - OnErrorInterface $onError + OnErrorInterface $onError, ): void { throw new \Exception(sprintf('Method %s should not be called.', __METHOD__)); } @@ -755,7 +755,7 @@ public function shouldFetchQueryAndUseMultipleDecodersAndCacheTheFinalResult(): new DummyQuery('fresh-data'), $key, CacheTime::oneMinute(), - $profilerId + $profilerId, ); $decoder = function (int $i) { @@ -792,7 +792,7 @@ public function shouldFetchQueryAndUseMultipleDecodersAndCacheTheFinalResult(): 'Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder', 'Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder', ], - $item->getDecodedBy() + $item->getDecodedBy(), ); } } @@ -812,7 +812,7 @@ public function shouldFetchQueryAndUseOnlyOneDecoder(): void new DummyQuery('fresh-data'), $key, CacheTime::oneMinute(), - $profilerId + $profilerId, ); $decoder = function (int $i) { @@ -851,7 +851,7 @@ public function shouldFetchQueryAndUseOnlyOneDecoder(): void $this->assertHandledBy(DummyQueryHandler::class, 'string', $item->getHandledBy()); $this->assertSame( ['Lmc\Cqrs\Types\Decoder\CallbackResponseDecoder>'], - $item->getDecodedBy() + $item->getDecodedBy(), ); } } @@ -911,7 +911,7 @@ public function shouldCacheResponseBeforeDecodingByImpureDecoder(): void $this->queryFetcher->fetch( $query, $expectsValueOnSuccess('translated[cs]: fresh-data'), - $onError + $onError, ); $item = $this->cache->getItem($key->getHashedKey()); @@ -923,7 +923,7 @@ public function shouldCacheResponseBeforeDecodingByImpureDecoder(): void $this->queryFetcher->fetch( $query, $expectsValueOnSuccess('translated[en]: fresh-data'), - $onError + $onError, ); $item = $this->cache->getItem($key->getHashedKey()); @@ -938,7 +938,7 @@ public function shouldCacheResponseBeforeDecodingByImpureDecoder(): void public function shouldUseProfilerBagVerbosity( string $verbosity, bool $withDecoder, - array $expectedAdditionalData + array $expectedAdditionalData, ): void { $this->profilerBag->setVerbosity($verbosity); @@ -968,7 +968,7 @@ public function shouldUseProfilerBagVerbosity( $profilerId, ), new OnSuccessCallback($this->ignore()), - new OnErrorCallback($this->ignore()) + new OnErrorCallback($this->ignore()), ); $this->assertCount(1, $this->profilerBag);