Skip to content

Commit 42711a6

Browse files
committed
CS Fixes
1 parent 6e9a40c commit 42711a6

File tree

9 files changed

+30
-28
lines changed

9 files changed

+30
-28
lines changed

features/bootstrap/ProfilerContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Behat\Mink\Exception\ExpectationException;
1919
use Behat\MinkExtension\Context\MinkContext;
2020
use PHPUnit\Framework\Assert;
21-
use Silverback\ApiComponentsBundle\Entity\Core\ComponentGroup;
2221
use Silverback\ApiComponentsBundle\Factory\User\Mailer\ChangeEmailConfirmationEmailFactory;
2322
use Silverback\ApiComponentsBundle\Factory\User\Mailer\PasswordChangedEmailFactory;
2423
use Silverback\ApiComponentsBundle\Factory\User\Mailer\PasswordResetEmailFactory;
@@ -76,6 +75,7 @@ private function getMercureMessageObjects(): array
7675

7776
/**
7877
* @Then there should be :count mercure messages
78+
*
7979
* @return Update[]
8080
*/
8181
public function thereShouldBeAPublishedMercureUpdatePublished(?int $count = null)
@@ -107,7 +107,7 @@ private function getMercureComponentGroupMessage()
107107
foreach ($messageObjects as $messageObject) {
108108
$messageData = $messageObject->getData();
109109
$messageAsArray = $this->jsonContext->getJsonAsArray($messageData);
110-
if($messageAsArray['@context'] === '/contexts/ComponentGroup') {
110+
if ('/contexts/ComponentGroup' === $messageAsArray['@context']) {
111111
return $messageAsArray;
112112
}
113113
}

src/ApiPlatform/Api/IriConverter.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use ApiPlatform\Api\IriConverterInterface;
1717
use ApiPlatform\Api\UrlGeneratorInterface;
1818
use ApiPlatform\Metadata\Operation;
19-
use Doctrine\ORM\EntityNotFoundException;
2019
use Silverback\ApiComponentsBundle\Entity\Core\Route;
2120

2221
/**
@@ -33,13 +32,6 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation
3332
return $this->decorated->getResourceFromIri($iri, $context, $operation);
3433
}
3534

36-
/**
37-
* @param $resource
38-
* @param int $referenceType
39-
* @param Operation|null $operation
40-
* @param array $context
41-
* @return string|null
42-
*/
4335
public function getIriFromResource($resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string
4436
{
4537
if ($resource instanceof Route && ($path = $resource->getPath())) {

src/DataProvider/PageDataProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Doctrine\ORM\EntityManager;
2323
use Doctrine\Persistence\ManagerRegistry;
2424
use Silverback\ApiComponentsBundle\Entity\Core\AbstractPageData;
25-
use Silverback\ApiComponentsBundle\Entity\Core\ComponentInterface;
2625
use Silverback\ApiComponentsBundle\Metadata\PageDataComponentMetadata;
2726
use Silverback\ApiComponentsBundle\Metadata\PageDataPropertyMetadata;
2827
use Silverback\ApiComponentsBundle\Metadata\Provider\PageDataMetadataProvider;

src/DataProvider/StateProvider/RouteStateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
3939
if ($operation instanceof CollectionOperationInterface) {
4040
return $this->defaultProvider->provide($operation->withProvider(CollectionProvider::class), $uriVariables, $context);
4141
}
42-
42+
4343
$id = $uriVariables['id'];
4444
if (!\is_string($id)) {
4545
return $this->defaultProvider->provide($operation->withProvider(ItemProvider::class), $uriVariables, $context);

src/DependencyInjection/SilverbackApiComponentsExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ private function loadServiceConfig(ContainerBuilder $container): void
245245
$loader->load('services.php');
246246
$loader->load('services_normalizers.php');
247247

248-
249248
$loader->load('services_doctrine_orm_http_cache_purger.php');
250249
$loader->load('services_doctrine_orm_mercure_publisher.php');
251250
}

src/EventListener/Doctrine/PropagateUpdatesListener.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This file is part of the Silverback API Components Bundle Project
5+
*
6+
* (c) Daniel West <daniel@silverback.is>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
314
namespace Silverback\ApiComponentsBundle\EventListener\Doctrine;
415

516
use ApiPlatform\Api\IriConverterInterface;
@@ -8,19 +19,16 @@
819
use ApiPlatform\Exception\InvalidArgumentException;
920
use ApiPlatform\Metadata\GetCollection;
1021
use Doctrine\Common\Util\ClassUtils;
11-
use Doctrine\DBAL\Platforms\SqlitePlatform;
1222
use Doctrine\ORM\EntityRepository;
1323
use Doctrine\ORM\Event\OnFlushEventArgs;
1424
use Doctrine\ORM\Event\PostFlushEventArgs;
15-
use Doctrine\ORM\Event\PreFlushEventArgs;
1625
use Doctrine\ORM\PersistentCollection;
1726
use Doctrine\ORM\UnitOfWork;
1827
use Doctrine\Persistence\ManagerRegistry;
1928
use Doctrine\Persistence\ObjectManager;
2029
use Doctrine\Persistence\ObjectRepository;
2130
use Silverback\ApiComponentsBundle\DataProvider\PageDataProvider;
2231
use Silverback\ApiComponentsBundle\Entity\Component\Collection;
23-
use Silverback\ApiComponentsBundle\Entity\Core\Page;
2432
use Silverback\ApiComponentsBundle\Entity\Core\PageDataInterface;
2533
use Silverback\ApiComponentsBundle\HttpCache\ResourceChangedPropagatorInterface;
2634
use Silverback\ApiComponentsBundle\Repository\Core\ComponentPositionRepository;
@@ -36,12 +44,7 @@ class PropagateUpdatesListener
3644
private array $updatedCollectionClassToIriMapping = [];
3745

3846
/**
39-
* @param IriConverterInterface $iriConverter
40-
* @param ManagerRegistry $entityManager
4147
* @param iterable|ResourceChangedPropagatorInterface[] $resourceChangedPropagators
42-
* @param ResourceClassResolverInterface $resourceClassResolver
43-
* @param PageDataProvider $pageDataProvider
44-
* @param ComponentPositionRepository $positionRepository
4548
*/
4649
public function __construct(
4750
private readonly IriConverterInterface $iriConverter,
@@ -90,7 +93,7 @@ private function collectUpdatedPageDataAndPositions(): void
9093
$pageDataComponentMetadata = $this->pageDataProvider->findPageDataComponentMetadata($updatedResource);
9194
foreach ($pageDataComponentMetadata as $pageDataComponentMetadatum) {
9295
$pageDataResources = $pageDataComponentMetadatum->getPageDataResources();
93-
if (count($pageDataResources)) {
96+
if (\count($pageDataResources)) {
9497
foreach ($pageDataResources as $pageDataResource) {
9598
$this->collectUpdatedResource($pageDataResource, 'updated');
9699
$this->addToPropagators($pageDataResource, 'updated');
@@ -191,7 +194,7 @@ private function addResourceIrisFromObject($resource, string $type): void
191194
{
192195
if (
193196
isset($this->updatedResources[$resource]) &&
194-
$type !== 'deleted'
197+
'deleted' !== $type
195198
) {
196199
return;
197200
}
@@ -226,7 +229,7 @@ private function collectDynamicComponentPositionResources(array $pageDataPropert
226229
if (!$pageDataPropertiesChanged) {
227230
$pageDataPropertiesChanged = $this->pageDataPropertiesChanged;
228231
}
229-
if (0 === count($pageDataPropertiesChanged)) {
232+
if (0 === \count($pageDataPropertiesChanged)) {
230233
return;
231234
}
232235
$positions = $this->positionRepository->findByPageDataProperties($pageDataPropertiesChanged);

src/EventListener/Doctrine/SqlLiteForeignKeyEnabler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This file is part of the Silverback API Components Bundle Project
5+
*
6+
* (c) Daniel West <daniel@silverback.is>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
314
namespace Silverback\ApiComponentsBundle\EventListener\Doctrine;
415

516
use Doctrine\DBAL\Platforms\SqlitePlatform;

src/Mercure/MercureResourcePublisher.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
2626
use ApiPlatform\Symfony\Messenger\DispatchTrait;
2727
use ApiPlatform\Util\ResourceClassInfoTrait;
28-
use Doctrine\ORM\EntityNotFoundException;
2928
use Doctrine\ORM\PersistentCollection;
3029
use Silverback\ApiComponentsBundle\HttpCache\ResourceChangedPropagatorInterface;
3130
use Symfony\Component\ExpressionLanguage\ExpressionFunction;

src/Resources/config/services.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,7 @@
13891389

13901390
$services
13911391
->set(SqlLiteForeignKeyEnabler::class)
1392-
->tag('doctrine.event_listener', ['event' => DoctrineEvents::preFlush])
1393-
;
1392+
->tag('doctrine.event_listener', ['event' => DoctrineEvents::preFlush]);
13941393

13951394
$services
13961395
->set('silverback.api_components.event_listener.doctrine.propagate_updates_listener')
@@ -1401,7 +1400,7 @@
14011400
new TaggedIteratorArgument('silverback_api_components.resource_changed_propagator'),
14021401
new Reference('api_platform.resource_class_resolver'),
14031402
new Reference(PageDataProvider::class),
1404-
new Reference('silverback.doctrine.repository.component_position')
1403+
new Reference('silverback.doctrine.repository.component_position'),
14051404
])
14061405
->tag('doctrine.event_listener', ['event' => DoctrineEvents::onFlush])
14071406
->tag('doctrine.event_listener', ['event' => DoctrineEvents::postFlush]);

0 commit comments

Comments
 (0)