Skip to content

Commit e9ee8f7

Browse files
committed
fix php 7 lowest
1 parent 7ca9b9b commit e9ee8f7

File tree

6 files changed

+106
-72
lines changed

6 files changed

+106
-72
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
env:
88
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99
COVERAGE: '0'
10+
SYMFONY_DEPRECATIONS_HELPER: 'disabled=1'
1011

1112
jobs:
1213
php-cs-fixer:
@@ -151,30 +152,30 @@ jobs:
151152
else
152153
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml
153154
fi
154-
# - name: Upload test artifacts
155-
# if: always()
156-
# uses: actions/upload-artifact@v1
157-
# with:
158-
# name: phpunit-logs-php${{ matrix.php }}
159-
# path: build/logs/phpunit
160-
# continue-on-error: true
161-
# - name: Upload coverage results to Codecov
162-
# if: matrix.coverage
163-
# uses: codecov/codecov-action@v1
164-
# with:
165-
# name: phpunit-php${{ matrix.php }}
166-
# flags: phpunit
167-
# fail_ci_if_error: true
168-
# continue-on-error: true
169-
# - name: Upload coverage results to Coveralls
170-
# if: matrix.coverage
171-
# env:
172-
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173-
# run: |
174-
# composer global require --prefer-dist --no-interaction --no-progress --ansi cedx/coveralls
175-
# export PATH="$PATH:$HOME/.composer/vendor/bin"
176-
# coveralls build/logs/phpunit/clover.xml
177-
# continue-on-error: true
155+
- name: Upload test artifacts
156+
if: always()
157+
uses: actions/upload-artifact@v1
158+
with:
159+
name: phpunit-logs-php${{ matrix.php }}
160+
path: build/logs/phpunit
161+
continue-on-error: true
162+
- name: Upload coverage results to Codecov
163+
if: matrix.coverage
164+
uses: codecov/codecov-action@v1
165+
with:
166+
name: phpunit-php${{ matrix.php }}
167+
flags: phpunit
168+
fail_ci_if_error: true
169+
continue-on-error: true
170+
- name: Upload coverage results to Coveralls
171+
if: matrix.coverage
172+
env:
173+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174+
run: |
175+
composer global require --prefer-dist --no-interaction --no-progress --ansi cedx/coveralls
176+
export PATH="$PATH:$HOME/.composer/vendor/bin"
177+
coveralls build/logs/phpunit/clover.xml
178+
continue-on-error: true
178179

179180
behat:
180181
name: Behat (PHP ${{ matrix.php }})

src/Core/Bridge/Doctrine/EventListener/PublishMercureUpdatesListener.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ final class PublishMercureUpdatesListener
7373
* @param array<string, string[]|string> $formats
7474
* @param HubRegistry|callable $hubRegistry
7575
*/
76-
public function __construct(ResourceClassResolverInterface $resourceClassResolver, IriConverterInterface $iriConverter, $resourceMetadataFactory, SerializerInterface $serializer, array $formats, MessageBusInterface $messageBus = null, $hubRegistry = null, ?GraphQlSubscriptionManagerInterface $graphQlSubscriptionManager = null, ?GraphQlMercureSubscriptionIriGeneratorInterface $graphQlMercureSubscriptionIriGenerator = null, ExpressionLanguage $expressionLanguage = null)
76+
public function __construct(ResourceClassResolverInterface $resourceClassResolver, IriConverterInterface $iriConverter, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, SerializerInterface $serializer, array $formats, MessageBusInterface $messageBus = null, $hubRegistry = null, ?GraphQlSubscriptionManagerInterface $graphQlSubscriptionManager = null, ?GraphQlMercureSubscriptionIriGeneratorInterface $graphQlMercureSubscriptionIriGenerator = null, ExpressionLanguage $expressionLanguage = null)
7777
{
7878
if (null === $messageBus && null === $hubRegistry) {
7979
throw new InvalidArgumentException('A message bus or a hub registry must be provided.');
@@ -173,14 +173,10 @@ private function storeObjectToPublish($object, string $property): void
173173
return;
174174
}
175175

176-
if ($this->resourceMetadataFactory instanceof ResourceMetadataCollectionFactoryInterface) {
177-
try {
178-
$options = $this->resourceMetadataFactory->create($resourceClass)->getOperation()->getMercure();
179-
} catch (OperationNotFoundException $e) {
180-
return;
181-
}
182-
} else {
183-
$options = $this->resourceMetadataFactory->create($resourceClass)->getAttribute('mercure', false);
176+
try {
177+
$options = $this->resourceMetadataFactory->create($resourceClass)->getOperation()->getMercure() ?? false;
178+
} catch (OperationNotFoundException $e) {
179+
return;
184180
}
185181

186182
if (\is_string($options)) {
@@ -273,12 +269,7 @@ private function publishUpdate($object, array $options, string $type): void
273269
$data = json_encode(['@id' => $object->id]);
274270
} else {
275271
$resourceClass = $this->getObjectClass($object);
276-
if ($this->resourceMetadataFactory instanceof ResourceMetadataCollectionFactoryInterface) {
277-
$context = $options['normalization_context'] ?? $this->resourceMetadataFactory->create($resourceClass)->getOperation()->getNormalizationContext();
278-
} else {
279-
// TODO: remove in 3.0
280-
$context = $options['normalization_context'] ?? $this->resourceMetadataFactory->create($resourceClass)->getAttribute('normalization_context', []);
281-
}
272+
$context = $options['normalization_context'] ?? $this->resourceMetadataFactory->create($resourceClass)->getOperation()->getNormalizationContext();
282273

283274
$iri = $options['topics'] ?? $this->iriConverter->getIriFromItem($object, null, UrlGeneratorInterface::ABS_URL);
284275
$data = $options['data'] ?? $this->serializer->serialize($object, key($this->formats), $context);

src/Core/Bridge/Symfony/Bundle/Resources/config/doctrine_orm_mercure_publisher.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<service id="api_platform.doctrine.orm.listener.mercure.publish" class="ApiPlatform\Core\Bridge\Doctrine\EventListener\PublishMercureUpdatesListener">
1212
<argument type="service" id="api_platform.resource_class_resolver" />
1313
<argument type="service" id="api_platform.iri_converter" />
14-
<argument type="service" id="api_platform.metadata.resource.metadata_factory" />
14+
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
1515
<argument type="service" id="api_platform.serializer" />
1616
<argument>%api_platform.formats%</argument>
1717
<argument type="service" id="messenger.default_bus" on-invalid="ignore" />

0 commit comments

Comments
 (0)