Skip to content

Commit 7bf2593

Browse files
committed
revert
1 parent cf8c7a0 commit 7bf2593

File tree

6 files changed

+8
-96
lines changed

6 files changed

+8
-96
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,85 +1153,6 @@ jobs:
11531153
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
11541154
continue-on-error: true
11551155

1156-
phpunit_legacy_errors:
1157-
name: PHPUnit Legacy errors (PHP ${{ matrix.php }})
1158-
env:
1159-
RFC_7807_COMPLIANT_ERRORS: 0
1160-
runs-on: ubuntu-latest
1161-
timeout-minutes: 20
1162-
strategy:
1163-
matrix:
1164-
php:
1165-
- '8.3'
1166-
include:
1167-
- php: '8.3'
1168-
coverage: true
1169-
fail-fast: false
1170-
steps:
1171-
- name: Checkout
1172-
uses: actions/checkout@v4
1173-
- name: Setup PHP
1174-
uses: shivammathur/setup-php@v2
1175-
with:
1176-
php-version: ${{ matrix.php }}
1177-
tools: pecl, composer
1178-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
1179-
coverage: pcov
1180-
ini-values: memory_limit=-1
1181-
- name: Get composer cache directory
1182-
id: composercache
1183-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
1184-
- name: Cache dependencies
1185-
uses: actions/cache@v4
1186-
with:
1187-
path: ${{ steps.composercache.outputs.dir }}
1188-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
1189-
restore-keys: ${{ runner.os }}-composer-
1190-
- name: Enable code coverage
1191-
if: matrix.coverage
1192-
run: echo "COVERAGE=1" >> $GITHUB_ENV
1193-
- name: Update project dependencies
1194-
run: composer update --no-interaction --no-progress --ansi
1195-
- name: Install PHPUnit
1196-
run: vendor/bin/simple-phpunit --version
1197-
- name: Clear test app cache
1198-
run: tests/Fixtures/app/console cache:clear --ansi
1199-
- name: Use legacy ignored deprecations
1200-
run: cp tests/.ignored-deprecations-legacy-events tests/.ignored-deprecations
1201-
- name: Run PHPUnit tests
1202-
run: |
1203-
mkdir -p build/logs/phpunit
1204-
if [ "$COVERAGE" = '1' ]; then
1205-
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --coverage-clover build/logs/phpunit/clover.xml
1206-
else
1207-
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml
1208-
fi
1209-
- name: Upload test artifacts
1210-
if: always()
1211-
uses: actions/upload-artifact@v4
1212-
with:
1213-
name: phpunit-logs-php${{ matrix.php }}
1214-
path: build/logs/phpunit
1215-
continue-on-error: true
1216-
- name: Upload coverage results to Codecov
1217-
if: matrix.coverage
1218-
uses: codecov/codecov-action@v3
1219-
with:
1220-
directory: build/logs/phpunit
1221-
name: phpunit-php${{ matrix.php }}
1222-
flags: phpunit
1223-
fail_ci_if_error: true
1224-
continue-on-error: true
1225-
- name: Upload coverage results to Coveralls
1226-
if: matrix.coverage
1227-
env:
1228-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1229-
run: |
1230-
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
1231-
export PATH="$PATH:$HOME/.composer/vendor/bin"
1232-
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
1233-
continue-on-error: true
1234-
12351156
behat_legacy:
12361157
name: Behat Legacy event listeners (PHP ${{ matrix.php }})
12371158
env:

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use ApiPlatform\Metadata\UriVariableTransformerInterface;
3737
use ApiPlatform\Metadata\UrlGeneratorInterface;
3838
use ApiPlatform\Metadata\Util\Inflector;
39+
use ApiPlatform\Problem\Serializer\ConstraintViolationListNormalizer;
3940
use ApiPlatform\State\ApiResource\Error;
4041
use ApiPlatform\State\ProcessorInterface;
4142
use ApiPlatform\State\ProviderInterface;
@@ -157,7 +158,7 @@ public function load(array $configs, ContainerBuilder $container): void
157158
$this->registerJsonApiConfiguration($formats, $loader, $config);
158159
$this->registerJsonLdHydraConfiguration($container, $formats, $loader, $config);
159160
$this->registerJsonHalConfiguration($formats, $loader);
160-
$this->registerJsonProblemConfiguration($errorFormats, $loader, $config);
161+
$this->registerJsonProblemConfiguration($errorFormats, $loader);
161162
$this->registerGraphQlConfiguration($container, $config, $loader);
162163
$this->registerCacheConfiguration($container);
163164
$this->registerDoctrineOrmConfiguration($container, $config, $loader);
@@ -585,13 +586,13 @@ private function registerJsonHalConfiguration(array $formats, XmlFileLoader $loa
585586
$loader->load('hal.xml');
586587
}
587588

588-
private function registerJsonProblemConfiguration(array $errorFormats, XmlFileLoader $loader, array $config): void
589+
private function registerJsonProblemConfiguration(array $errorFormats, XmlFileLoader $loader): void
589590
{
590591
if (!isset($errorFormats['jsonproblem'])) {
591592
return;
592593
}
593594

594-
if (false === ($config['defaults']['extra_properties']['rfc_7807_compliant_errors'] ?? true)) {
595+
if (class_exists(ConstraintViolationListNormalizer::class)) {
595596
$loader->load('legacy/problem.xml');
596597
}
597598

tests/Fixtures/app/AppKernel.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [
245245
$legacyConfig = ['event_listeners_backward_compatibility_layer' => $metadataBackwardCompatibilityLayer];
246246
}
247247

248-
if (!$rfc7807CompliantErrors) {
249-
$loader->load(__DIR__.'/config/config_legacy_error.yml');
250-
}
251-
252248
$c->prependExtensionConfig('api_platform', $legacyConfig + [
253249
'mapping' => [
254250
'paths' => ['%kernel.project_dir%/../TestBundle/Resources/config/api_resources'],

tests/Fixtures/app/config/config_common.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ services:
433433
arguments:
434434
$decorated: '@.inner'
435435

436+
ApiPlatform\Tests\Fixtures\TestBundle\Serializer\ErrorNormalizer:
437+
decorates: 'api_platform.problem.normalizer.error'
438+
arguments: [ '@.inner' ]
439+
436440
api_platform.http_cache.tag_collector:
437441
class: ApiPlatform\Tests\Fixtures\TestBundle\HttpCache\TagCollectorDefault
438442
public: true

tests/Fixtures/app/config/config_legacy_error.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/Symfony/Bundle/Test/ApiTestCaseTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,6 @@ private function recreateSchema(array $options = []): void
345345
*/
346346
public function testExceptionNormalizer(): void
347347
{
348-
$container = static::getContainer();
349-
if (true === static::$kernel->getContainer()->getParameter('api_platform.rfc_7807_compliant_errors')) {
350-
$this->markTestSkipped();
351-
}
352-
353348
$response = self::createClient()->request('GET', '/issue5921', [
354349
'headers' => [
355350
'accept' => 'application/json',

0 commit comments

Comments
 (0)