Skip to content

Commit

Permalink
Allow Symfony 7 (see #7279)
Browse files Browse the repository at this point in the history
Description
-----------

5.3 LTS requires Symfony 6.4 LTS as per our roadmap.

This means, Contao 5.4 must allow Symfony 7 components.

Dependencies:

- [x] `contao/manager-plugin`: contao/manager-plugin#56
- [x] `contao/image`: contao/image#104
- [x] `terminal42/service-annotation-bundle`: terminal42/service-annotation-bundle#9
- [x] `terminal42/escargot`: terminal42/escargot#36
- [x] Merge contao/contao#7285 in `5.3`and then uptream into `5.x`

Commits
-------

0aa8323a Allow Symfony 7 in all packages
277005c0 Update to nikic/php-parser v5 in order to fix PHP incompatiblity issues
1eb7d8b2 Fixed test incompatibilities
a4eb15d6 Fixed DoctrineSchemaListener
a19c436e Fixed phpstan
af07922f Update calendar-bundle/composer.json
103d01e2 Update scheb/2fa bundles
01dca93a Fix interface incompatibility
15ebe558 Updated FOS HttpCache related dependencies
d18e73bd Apply suggestions from code review
aef96c3b Fixed the LocaleSubscriberTest
5aef4aad Revert changes
ade83931 Cleanup
0c2b1713 Use the existing news bundle when installing the core bundle in the "…

Co-authored-by: leofeyer <[email protected]>
  • Loading branch information
Toflar and leofeyer authored Jun 25, 2024
1 parent b69b8f7 commit c1bb4d8
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 59 deletions.
94 changes: 47 additions & 47 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"doctrine/persistence": "^3.2",
"dragonmantank/cron-expression": "^2.3",
"debril/feed-io": "^6.0",
"friendsofsymfony/http-cache": "^2.15.1",
"friendsofsymfony/http-cache-bundle": "^2.6",
"friendsofsymfony/http-cache": "^3.0",
"friendsofsymfony/http-cache-bundle": "^3.0",
"guzzlehttp/promises": "^1.5",
"imagine/imagine": "^1.2.4",
"knplabs/knp-menu": "^3.1",
Expand All @@ -84,69 +84,69 @@
"monolog/monolog": "^3.0",
"nelmio/cors-bundle": "^2.0.1",
"nelmio/security-bundle": "^3.0",
"nikic/php-parser": "^4.9",
"nikic/php-parser": "^5.0",
"nyholm/psr7": "^1.2",
"paragonie/constant_time_encoding": "^2.2",
"phpspec/php-diff": "^1.0",
"psr/cache": "^3.0",
"psr/container": "^2.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/log": "^1.1 || 2.0 || ^3.0",
"scheb/2fa-backup-code": "^6.0",
"scheb/2fa-bundle": "^6.0",
"scheb/2fa-trusted-device": "^6.0",
"scheb/2fa-backup-code": "^6.0 || ^7.0",
"scheb/2fa-bundle": "^6.0 || ^7.0",
"scheb/2fa-trusted-device": "^6.0 || ^7.0",
"scrivo/highlight.php": "^9.18",
"scssphp/scssphp": "^1.5",
"simplepie/simplepie": "^1.3",
"spatie/schema-org": "^3.4",
"spomky-labs/otphp": "^10.0",
"symfony-cmf/routing": "^3.0",
"symfony-cmf/routing-bundle": "^3.0",
"symfony/asset": "^6.4",
"symfony/asset": "^6.4 || ^7.0",
"symfony/cache-contracts": "^3.0",
"symfony/config": "^6.4",
"symfony/console": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/config": "^6.4 || ^7.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/deprecation-contracts": "^3.0",
"symfony/doctrine-bridge": "^6.4",
"symfony/doctrine-messenger": "^6.4",
"symfony/dom-crawler": "^6.4",
"symfony/event-dispatcher": "^6.4",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/doctrine-messenger": "^6.4 || ^7.0",
"symfony/dom-crawler": "^6.4 || ^7.0",
"symfony/event-dispatcher": "^6.4 || ^7.0",
"symfony/event-dispatcher-contracts": "^3.0",
"symfony/expression-language": "^6.4",
"symfony/filesystem": "^6.4",
"symfony/finder": "^6.4",
"symfony/framework-bundle": "^6.4",
"symfony/html-sanitizer": "^6.4",
"symfony/http-client": "^6.4",
"symfony/expression-language": "^6.4 || ^7.0",
"symfony/filesystem": "^6.4 || ^7.0",
"symfony/finder": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/html-sanitizer": "^6.4 || ^7.0",
"symfony/http-client": "^6.4 || ^7.0",
"symfony/http-client-contracts": "^3.1",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/intl": "^6.4",
"symfony/mailer": "^6.4",
"symfony/messenger": "^6.4",
"symfony/mime": "^6.4",
"symfony/monolog-bridge": "^6.4",
"symfony/password-hasher": "^6.4",
"symfony/http-foundation": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/intl": "^6.4 || ^7.0",
"symfony/mailer": "^6.4 || ^7.0",
"symfony/messenger": "^6.4 || ^7.0",
"symfony/mime": "^6.4 || ^7.0",
"symfony/monolog-bridge": "^6.4 || ^7.0",
"symfony/password-hasher": "^6.4 || ^7.0",
"symfony/polyfill-intl-idn": "^1.0",
"symfony/polyfill-mbstring": "^1.0",
"symfony/process": "^6.4",
"symfony/property-access": "^6.4",
"symfony/rate-limiter": "^6.4",
"symfony/routing": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/security-core": "^6.4",
"symfony/security-csrf": "^6.4",
"symfony/security-http": "^6.4",
"symfony/process": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/rate-limiter": "^6.4 || ^7.0",
"symfony/routing": "^6.4 || ^7.0",
"symfony/security-bundle": "^6.4 || ^7.0",
"symfony/security-core": "^6.4 || ^7.0",
"symfony/security-csrf": "^6.4 || ^7.0",
"symfony/security-http": "^6.4 || ^7.0",
"symfony/service-contracts": "^3.0",
"symfony/string": "^6.4",
"symfony/translation": "^6.4",
"symfony/string": "^6.4 || ^7.0",
"symfony/translation": "^6.4 || ^7.0",
"symfony/translation-contracts": "^3.0",
"symfony/twig-bridge": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/uid": "^6.4",
"symfony/var-dumper": "^6.4",
"symfony/yaml": "^6.4",
"symfony/twig-bridge": "^6.4 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.0",
"symfony/uid": "^6.4 || ^7.0",
"symfony/var-dumper": "^6.4 || ^7.0",
"symfony/yaml": "^6.4 || ^7.0",
"terminal42/escargot": "^1.6",
"terminal42/service-annotation-bundle": "^1.1",
"toflar/cronjob-supervisor": "^2.0",
Expand All @@ -166,11 +166,11 @@
"league/flysystem-memory": "^3.0",
"phpunit/phpunit": "^9.5.19",
"sebastian/diff": "^4.0",
"symfony/browser-kit": "^6.4",
"symfony/cache": "^6.4",
"symfony/browser-kit": "^6.4 || ^7.0",
"symfony/cache": "^6.4 || ^7.0",
"symfony/monolog-bundle": "^3.1",
"symfony/phpunit-bridge": "^6.4",
"symfony/web-profiler-bundle": "^6.4"
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"symfony/web-profiler-bundle": "^6.4 || ^7.0"
},
"conflict": {
"contao-community-alliance/composer-plugin": "<3.0",
Expand Down
2 changes: 1 addition & 1 deletion contao/library/Contao/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function __unserialize(array $data): void
/**
* {@inheritdoc}
*/
public function eraseCredentials()
public function eraseCredentials(): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Config/Loader/PhpFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function supports(mixed $resource, string|null $type = null): bool
private function parseFile(string $file): array
{
$ast = (new ParserFactory())
->create(ParserFactory::PREFER_PHP7)
->createForHostVersion()
->parse(trim(file_get_contents($file)))
;

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function pickerAction(Request $request): RedirectResponse
if ($request->query->has('extras')) {
$extras = $request->query->all('extras');

if (empty($extras)) {
if ([] === $extras) {
throw new BadRequestHttpException('Invalid picker extras');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/ContaoCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Toflar\CronjobSupervisor\Supervisor;

class ContaoCoreExtension extends Extension implements PrependExtensionInterface, ConfigureFilesystemInterface
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DoctrineSchemaListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function postGenerateSchema(GenerateSchemaEventArgs $event): void
continue;
}

$transport->configureSchema($event->getSchema(), $event->getEntityManager()->getConnection());
$transport->configureSchema($event->getSchema(), $event->getEntityManager()->getConnection(), static fn () => false);
}
}
}
2 changes: 2 additions & 0 deletions src/Translation/DataCollectorTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

/**
* @internal
*
* @phpstan-ignore class.extendsFinalByPhpDoc
*/
class DataCollectorTranslator extends SymfonyDataCollectorTranslator implements ResetInterface
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/BackendPreviewSwitchControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
use Doctrine\DBAL\Result;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\RouterInterface;
Expand Down Expand Up @@ -180,7 +180,7 @@ public function testReturnsErrorWithInvalidUsername(): void
);

$request = $this->createMock(Request::class);
$request->request = new ParameterBag(['FORM_SUBMIT' => 'tl_switch', 'user' => 'foobar']);
$request->request = new InputBag(['FORM_SUBMIT' => 'tl_switch', 'user' => 'foobar']);

$request
->method('isXmlHttpRequest')
Expand Down
6 changes: 3 additions & 3 deletions tests/EventListener/PreviewUrlConverterListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Contao\CoreBundle\Tests\TestCase;
use Contao\PageModel;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\UriSigner;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
Expand Down Expand Up @@ -206,7 +206,7 @@ public function testRediectsToFragmentUrlIfPreviewUrlThrowsException(): void
$route = new PageRoute($pageModel);

$request = $this->createMock(Request::class);
$request->query = new ParameterBag(['page' => '9']);
$request->query = new InputBag(['page' => '9']);

$request
->expects($this->once())
Expand Down Expand Up @@ -267,7 +267,7 @@ public function testReturnsEmptyUrlForPagesThatRequireAnItem(): void
$route = new PageRoute($pageModel);

$request = $this->createMock(Request::class);
$request->query = new ParameterBag(['page' => '42']);
$request->query = new InputBag(['page' => '42']);

$adapters = [
PageModel::class => $this->mockConfiguredAdapter(['findWithDetails' => $pageModel]),
Expand Down
4 changes: 2 additions & 2 deletions tests/Translation/MessageCatalogueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function testForwardsIfDomainIsNotContao(string $method, array $params, a
->expects($this->once())
->method($method)
->with(...$params)
->willReturn($return)
->willReturnCallback(static fn () => $return)
;

$catalogue = $this->createCatalogue($parentCatalogue);
Expand Down Expand Up @@ -238,7 +238,7 @@ public function testForwardsCompletelyToParent(string $method, array $params, mi
->expects($this->once())
->method($method)
->with(...$params)
->willReturn($return)
->willReturnCallback(static fn () => $return)
;

$catalogue = $this->createCatalogue($parentCatalogue);
Expand Down

0 comments on commit c1bb4d8

Please sign in to comment.