Skip to content

Commit

Permalink
style: update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
tinect committed Jul 7, 2024
1 parent c147035 commit 1fe5617
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ "v6.6.0.0-rc4" ]
version: [ "v6.6.0.0", "v6.6.1.2", "v6.6.2.0", "v6.6.3.1", "v6.6.4.0", "trunk" ]
runs-on: ubuntu-latest
steps:
- name: Setup Shopware
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"php-cs-fixer": [
".ci/vendor/bin/php-cs-fixer fix --diff --config=.ci/.php-cs-fixer.dist.php"
],
"phpstan": "docker run --rm -v $(pwd):/app aragon999/phpstan-shopware:v6.5.7 analyse ."
"phpstan": "docker run --rm -v $(pwd):/app aragon999/phpstan-shopware:v6.6.0 analyse ."
}
}
26 changes: 0 additions & 26 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@ parameters:
paths:
- src
ignoreErrors:
-
message: """
#^Call to method __construct\\(\\) of deprecated class Shopware\\\\Core\\\\Framework\\\\MessageQueue\\\\ScheduledTask\\\\ScheduledTaskHandler\\:
tag\\:v6\\.6\\.0 \\- reason\\:class\\-hierarchy\\-change \\- Won't implement MessageSubscriberInterface anymore, tag all ScheduledTaskHandlers with \\#\\[AsMessageHandler\\] instead$#
"""
count: 1
path: src/Task/CleanupTaskHandler.php
reportUnmatched: false

-
message: """
#^Class Tinect\\\\Redirects\\\\Task\\\\CleanupTaskHandler extends deprecated class Shopware\\\\Core\\\\Framework\\\\MessageQueue\\\\ScheduledTask\\\\ScheduledTaskHandler\\:
tag\\:v6\\.6\\.0 \\- reason\\:class\\-hierarchy\\-change \\- Won't implement MessageSubscriberInterface anymore, tag all ScheduledTaskHandlers with \\#\\[AsMessageHandler\\] instead$#
"""
count: 1
path: src/Task/CleanupTaskHandler.php
reportUnmatched: false

-
message: """
#^Fetching deprecated class constant PARAM_STR_ARRAY of class Doctrine\\\\DBAL\\\\Connection\\:
Use \\{@see ArrayParameterType\\:\\:STRING\\} instead\\.$#
"""
count: 1
path: src/Task/CleanupTaskHandler.php
reportUnmatched: false

-
message: '#.* generic class Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository.*not specify its types: TEntityCollection#'
Expand Down
4 changes: 2 additions & 2 deletions src/Message/TinectRedirectUpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
class TinectRedirectUpdateHandler
readonly class TinectRedirectUpdateHandler
{
public function __construct(
private readonly Connection $connection,
private Connection $connection,
) {
}

Expand Down
18 changes: 9 additions & 9 deletions src/Message/TinectRedirectUpdateMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
use Shopware\Core\Framework\MessageQueue\LowPriorityMessageInterface;
use Tinect\Redirects\Content\Redirect\RedirectRequestDefinition;

class TinectRedirectUpdateMessage implements LowPriorityMessageInterface
readonly class TinectRedirectUpdateMessage implements LowPriorityMessageInterface
{
private readonly \DateTimeImmutable $createdAt;
private \DateTimeImmutable $createdAt;

public function __construct(
private readonly string $source,
private readonly ?string $salesChannelDomainId,
private readonly string $ipAddress,
private readonly string $userAgent,
private readonly bool $createRedirect,
private readonly ?string $id,
private readonly ?string $referer,
private string $source,
private ?string $salesChannelDomainId,
private string $ipAddress,
private string $userAgent,
private bool $createRedirect,
private ?string $id,
private ?string $referer,
) {
$this->createdAt = new \DateTimeImmutable();
}
Expand Down
14 changes: 7 additions & 7 deletions src/Subscriber/BeforeSendResponseSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
use Tinect\Redirects\Content\Redirect\RedirectEntity;
use Tinect\Redirects\Message\TinectRedirectUpdateMessage;

class BeforeSendResponseSubscriber implements EventSubscriberInterface
readonly class BeforeSendResponseSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly EntityRepository $tinectRedirectsRedirectRepository,
private readonly SeoUrlPlaceholderHandlerInterface $seoUrlPlaceholderHandler,
private EntityRepository $tinectRedirectsRedirectRepository,
private SeoUrlPlaceholderHandlerInterface $seoUrlPlaceholderHandler,
#[Autowire(service: SalesChannelContextFactory::class)]
private readonly AbstractSalesChannelContextFactory $salesChannelContextFactory,
private readonly SystemConfigService $systemConfigService,
private readonly MessageBusInterface $messageBus,
private readonly RequestTransformer $requestTransformer
private AbstractSalesChannelContextFactory $salesChannelContextFactory,
private SystemConfigService $systemConfigService,
private MessageBusInterface $messageBus,
private RequestTransformer $requestTransformer
) {
}

Expand Down
9 changes: 6 additions & 3 deletions src/Task/CleanupTaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Tinect\Redirects\Task;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Psr\Log\LoggerInterface;
use Shopware\Core\Defaults;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler;
Expand All @@ -17,10 +19,11 @@ class CleanupTaskHandler extends ScheduledTaskHandler
{
public function __construct(
EntityRepository $scheduledTaskRepository,
LoggerInterface $logger,
private readonly SystemConfigService $configService,
private readonly Connection $connection
private readonly Connection $connection,
) {
parent::__construct($scheduledTaskRepository);
parent::__construct($scheduledTaskRepository, $logger);
}

public function run(): void
Expand Down Expand Up @@ -56,7 +59,7 @@ public function run(): void
$deleteQuery->where('id IN (:ids)');

foreach (\array_chunk($ids, 1000) as $chunk) {
$deleteQuery->setParameter('ids', $chunk, Connection::PARAM_STR_ARRAY);
$deleteQuery->setParameter('ids', $chunk, ArrayParameterType::STRING);
$deleteQuery->executeQuery();
}

Expand Down

0 comments on commit 1fe5617

Please sign in to comment.