Skip to content

Commit bb32519

Browse files
authored
Add support for Symfony 8 (#8363)
1 parent 2b699f8 commit bb32519

File tree

83 files changed

+40
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+40
-403
lines changed

composer.json

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
],
2525
"homepage": "https://docs.sonata-project.org/projects/SonataAdminBundle",
2626
"require": {
27-
"php": "^8.1",
27+
"php": "^8.2",
2828
"doctrine/collections": "^1.6 || ^2.0",
2929
"doctrine/common": "^3.0",
3030
"knplabs/knp-menu": "^3.6",
@@ -36,59 +36,56 @@
3636
"sonata-project/exporter": "^3.1.1",
3737
"sonata-project/form-extensions": "^2.0",
3838
"sonata-project/twig-extensions": "^2.0",
39-
"symfony/asset": "^6.4 || ^7.1",
40-
"symfony/config": "^6.4 || ^7.1",
41-
"symfony/console": "^6.4 || ^7.1",
42-
"symfony/dependency-injection": "^6.4 || ^7.1",
39+
"symfony/asset": "^6.4 || ^7.3 || ^8.0",
40+
"symfony/config": "^6.4 || ^7.3 || ^8.0",
41+
"symfony/console": "^6.4 || ^7.3 || ^8.0",
42+
"symfony/dependency-injection": "^6.4 || ^7.3 || ^8.0",
4343
"symfony/deprecation-contracts": "^3.6",
44-
"symfony/doctrine-bridge": "^6.4 || ^7.1",
45-
"symfony/event-dispatcher": "^6.4 || ^7.1",
44+
"symfony/doctrine-bridge": "^6.4 || ^7.3 || ^8.0",
45+
"symfony/event-dispatcher": "^6.4 || ^7.3 || ^8.0",
4646
"symfony/event-dispatcher-contracts": "^2.0 || ^3.0",
47-
"symfony/expression-language": "^6.4 || ^7.1",
48-
"symfony/form": "^6.4 || ^7.1",
49-
"symfony/framework-bundle": "^6.4 || ^7.1",
50-
"symfony/http-foundation": "^6.4 || ^7.1",
51-
"symfony/http-kernel": "^6.4 || ^7.1",
52-
"symfony/options-resolver": "^6.4 || ^7.1",
53-
"symfony/property-access": "^6.4 || ^7.1",
54-
"symfony/routing": "^6.4 || ^7.1",
47+
"symfony/expression-language": "^6.4 || ^7.3 || ^8.0",
48+
"symfony/form": "^6.4 || ^7.3 || ^8.0",
49+
"symfony/framework-bundle": "^6.4 || ^7.3 || ^8.0",
50+
"symfony/http-foundation": "^6.4 || ^7.3 || ^8.0",
51+
"symfony/http-kernel": "^6.4 || ^7.3 || ^8.0",
52+
"symfony/options-resolver": "^6.4 || ^7.3 || ^8.0",
53+
"symfony/property-access": "^6.4 || ^7.3 || ^8.0",
54+
"symfony/routing": "^6.4 || ^7.3 || ^8.0",
5555
"symfony/security-acl": "^3.1",
56-
"symfony/security-bundle": "^6.4 || ^7.1",
57-
"symfony/security-core": "^6.4 || ^7.1",
58-
"symfony/security-csrf": "^6.4 || ^7.1",
59-
"symfony/serializer": "^6.4 || ^7.1",
56+
"symfony/security-bundle": "^6.4 || ^7.3 || ^8.0",
57+
"symfony/security-core": "^6.4 || ^7.3 || ^8.0",
58+
"symfony/security-csrf": "^6.4 || ^7.3 || ^8.0",
59+
"symfony/serializer": "^6.4 || ^7.3 || ^8.0",
6060
"symfony/stimulus-bundle": "^2.22",
61-
"symfony/string": "^6.4 || ^7.1",
62-
"symfony/translation": "^6.4 || ^7.1",
61+
"symfony/string": "^6.4 || ^7.3 || ^8.0",
62+
"symfony/translation": "^6.4 || ^7.3 || ^8.0",
6363
"symfony/translation-contracts": "^2.3 || ^3.0",
64-
"symfony/twig-bridge": "^6.4 || ^7.1",
65-
"symfony/twig-bundle": "^6.4 || ^7.1",
66-
"symfony/validator": "^6.4 || ^7.1",
64+
"symfony/twig-bridge": "^6.4 || ^7.3 || ^8.0",
65+
"symfony/twig-bundle": "^6.4 || ^7.3 || ^8.0",
66+
"symfony/validator": "^6.4 || ^7.3 || ^8.0",
6767
"twig/string-extra": "^3.0",
6868
"twig/twig": "^3.15"
6969
},
7070
"require-dev": {
7171
"doctrine/persistence": "^3.0",
7272
"friendsofphp/php-cs-fixer": "^3.4",
7373
"matthiasnoback/symfony-config-test": "^6.1",
74-
"matthiasnoback/symfony-dependency-injection-test": "^6.1",
74+
"matthiasnoback/symfony-dependency-injection-test": "^6.2",
7575
"phpstan/extension-installer": "^1.0",
7676
"phpstan/phpdoc-parser": "^1.0",
7777
"phpstan/phpstan": "^1.0 || ^2.0",
7878
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
7979
"phpstan/phpstan-strict-rules": "^1.0 || ^2.0",
8080
"phpstan/phpstan-symfony": "^1.0 || ^2.0",
81-
"phpunit/phpunit": "^10.5.54 || ^11.5.38",
82-
"psalm/plugin-phpunit": "^0.18 || ^0.19",
83-
"psalm/plugin-symfony": "^5.0",
81+
"phpunit/phpunit": "^11.5.38",
8482
"psr/event-dispatcher": "^1.0",
8583
"rector/rector": "^1.1 || ^2.0",
86-
"symfony/browser-kit": "^6.4 || ^7.1",
87-
"symfony/css-selector": "^6.4 || ^7.1",
88-
"symfony/filesystem": "^6.4 || ^7.1",
84+
"symfony/browser-kit": "^6.4 || ^7.3 || ^8.0",
85+
"symfony/css-selector": "^6.4 || ^7.3 || ^8.0",
86+
"symfony/filesystem": "^6.4 || ^7.3 || ^8.0",
8987
"symfony/maker-bundle": "^1.25",
90-
"symfony/yaml": "^6.4 || ^7.1",
91-
"vimeo/psalm": "^5.8.0 || ^6.10.0"
88+
"symfony/yaml": "^6.4 || ^7.3 || ^8.0"
9289
},
9390
"suggest": {
9491
"twig/extra-bundle": "Auto configures the Twig Intl extension"

psalm.xml

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

src/Admin/AbstractAdmin.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,6 @@ final public function getFilterFieldDescriptions(): array
12581258
return $this->filterFieldDescriptions;
12591259
}
12601260

1261-
/**
1262-
* @psalm-suppress PossiblyNullArgument Will be solved in NEXT_MAJOR
1263-
*/
12641261
final public function addChild(AdminInterface $child, ?string $field = null): void
12651262
{
12661263
$parentAdmin = $this;
@@ -1503,8 +1500,6 @@ public function showInDashboard(): bool
15031500
{
15041501
/**
15051502
* NEXT_MAJOR: Remove those lines and uncomment the last one.
1506-
*
1507-
* @psalm-suppress DeprecatedMethod, DeprecatedConstant
15081503
*/
15091504
$permissionShow = $this->getPermissionsShow(self::CONTEXT_DASHBOARD, 'sonata_deprecation_mute');
15101505
$permission = 1 === \count($permissionShow) ? reset($permissionShow) : $permissionShow;
@@ -1517,8 +1512,6 @@ public function showInDashboard(): bool
15171512
* NEXT_MAJOR: Remove this method.
15181513
*
15191514
* @deprecated since sonata-project/admin-bundle version 4.7 use showInDashboard instead
1520-
*
1521-
* @psalm-suppress DeprecatedMethod
15221515
*/
15231516
final public function showIn(string $context): bool
15241517
{
@@ -1822,9 +1815,6 @@ protected function configure(): void
18221815
{
18231816
}
18241817

1825-
/**
1826-
* @psalm-suppress DeprecatedProperty
1827-
*/
18281818
protected function generateBaseRoutePattern(bool $isChildAdmin = false): string
18291819
{
18301820
// NEXT_MAJOR: Remove this code
@@ -1859,9 +1849,6 @@ protected function generateBaseRoutePattern(bool $isChildAdmin = false): string
18591849
);
18601850
}
18611851

1862-
/**
1863-
* @psalm-suppress DeprecatedProperty
1864-
*/
18651852
protected function generateBaseRouteName(bool $isChildAdmin = false): string
18661853
{
18671854
// NEXT_MAJOR: Remove this code
@@ -2423,7 +2410,6 @@ private function buildDatagrid(): ?DatagridInterface
24232410

24242411
$this->datagrid->getPager()->setMaxPageLinks($this->getMaxPageLinks());
24252412

2426-
/** @psalm-suppress InvalidArgument https://github.com/vimeo/psalm/issues/8423 */
24272413
$mapper = new DatagridMapper($this->getDatagridBuilder(), $this->datagrid, $this);
24282414

24292415
// build the datagrid filter

src/Admin/Pool.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ public function getDashboardGroups(): array
108108
AdminInterface::class
109109
), \E_USER_DEPRECATED);
110110

111-
/**
112-
* @psalm-suppress DeprecatedMethod, DeprecatedConstant
113-
*/
114111
if (!$admin->showIn(AbstractAdmin::CONTEXT_DASHBOARD)) {
115112
continue;
116113
}

src/Builder/AbstractFormContractor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
use Symfony\Component\Form\FormFactoryInterface;
2727
use Symfony\Component\Form\FormRegistryInterface;
2828

29-
/**
30-
* @psalm-suppress DeprecatedInterface
31-
*/
3229
abstract class AbstractFormContractor implements FormContractorInterface
3330
{
3431
/**

src/Command/QuestionableCommand.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ final protected function askConfirmation(
6060
return $questionHelper->ask($input, $output, $question);
6161
}
6262

63-
/**
64-
* @psalm-suppress LessSpecificReturnStatement, MoreSpecificReturnType
65-
*/
6663
final protected function getQuestionHelper(): QuestionHelper
6764
{
6865
return $this->getHelper('question');

src/Controller/CRUDController.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
*
6161
* @phpstan-template T of object
6262
*
63-
* @psalm-suppress MissingConstructor
64-
*
6563
* @see ConfigureCRUDControllerListener
6664
*/
6765
class CRUDController extends AbstractController
@@ -72,15 +70,12 @@ class CRUDController extends AbstractController
7270
* @var AdminInterface<object>
7371
*
7472
* @phpstan-var AdminInterface<T>
75-
*
76-
* @psalm-suppress PropertyNotSetInConstructor
7773
*/
7874
protected $admin;
7975

8076
/**
8177
* The template registry of the related Admin class.
8278
*
83-
* @psalm-suppress PropertyNotSetInConstructor
8479
* @phpstan-ignore-next-line
8580
*/
8681
private TemplateRegistryInterface $templateRegistry;
@@ -136,9 +131,6 @@ public function listAction(Request $request): Response
136131
$exportFormats = $exporter->getAvailableFormats($this->admin);
137132
}
138133

139-
/**
140-
* @psalm-suppress DeprecatedMethod
141-
*/
142134
return $this->renderWithExtraParams($template, [
143135
'action' => 'list',
144136
'form' => $formView,
@@ -265,9 +257,6 @@ public function deleteAction(Request $request): Response
265257

266258
$template = $this->templateRegistry->getTemplate('delete');
267259

268-
/**
269-
* @psalm-suppress DeprecatedMethod
270-
*/
271260
return $this->renderWithExtraParams($template, [
272261
'object' => $object,
273262
'action' => 'delete',
@@ -376,9 +365,6 @@ public function editAction(Request $request): Response
376365

377366
$template = $this->templateRegistry->getTemplate($templateKey);
378367

379-
/**
380-
* @psalm-suppress DeprecatedMethod
381-
*/
382368
return $this->renderWithExtraParams($template, [
383369
'action' => 'edit',
384370
'form' => $formView,
@@ -499,9 +485,6 @@ public function batchAction(Request $request): Response
499485

500486
$template = $batchAction['template'] ?? $this->templateRegistry->getTemplate('batch_confirmation');
501487

502-
/**
503-
* @psalm-suppress DeprecatedMethod
504-
*/
505488
return $this->renderWithExtraParams($template, [
506489
'action' => 'list',
507490
'action_label' => $actionLabel,
@@ -557,9 +540,6 @@ public function createAction(Request $request): Response
557540
$class = new \ReflectionClass($this->admin->hasActiveSubClass() ? $this->admin->getActiveSubClass() : $this->admin->getClass());
558541

559542
if ($class->isAbstract()) {
560-
/**
561-
* @psalm-suppress DeprecatedMethod
562-
*/
563543
return $this->renderWithExtraParams(
564544
'@SonataAdmin/CRUD/select_subclass.html.twig',
565545
[
@@ -648,9 +628,6 @@ public function createAction(Request $request): Response
648628

649629
$template = $this->templateRegistry->getTemplate($templateKey);
650630

651-
/**
652-
* @psalm-suppress DeprecatedMethod
653-
*/
654631
return $this->renderWithExtraParams($template, [
655632
'action' => 'create',
656633
'form' => $formView,
@@ -683,9 +660,6 @@ public function showAction(Request $request): Response
683660

684661
$template = $this->templateRegistry->getTemplate('show');
685662

686-
/**
687-
* @psalm-suppress DeprecatedMethod
688-
*/
689663
return $this->renderWithExtraParams($template, [
690664
'action' => 'show',
691665
'object' => $object,
@@ -724,9 +698,6 @@ public function historyAction(Request $request): Response
724698

725699
$template = $this->templateRegistry->getTemplate('history');
726700

727-
/**
728-
* @psalm-suppress DeprecatedMethod
729-
*/
730701
return $this->renderWithExtraParams($template, [
731702
'action' => 'history',
732703
'object' => $object,
@@ -778,9 +749,6 @@ public function historyViewRevisionAction(Request $request, string $revision): R
778749

779750
$template = $this->templateRegistry->getTemplate('show');
780751

781-
/**
782-
* @psalm-suppress DeprecatedMethod
783-
*/
784752
return $this->renderWithExtraParams($template, [
785753
'action' => 'show',
786754
'object' => $object,
@@ -841,9 +809,6 @@ public function historyCompareRevisionsAction(Request $request, string $baseRevi
841809

842810
$template = $this->templateRegistry->getTemplate('show_compare');
843811

844-
/**
845-
* @psalm-suppress DeprecatedMethod
846-
*/
847812
return $this->renderWithExtraParams($template, [
848813
'action' => 'show',
849814
'object' => $baseObject,
@@ -952,9 +917,6 @@ public function aclAction(Request $request): Response
952917

953918
$template = $this->templateRegistry->getTemplate('acl');
954919

955-
/**
956-
* @psalm-suppress DeprecatedMethod
957-
*/
958920
return $this->renderWithExtraParams($template, [
959921
'action' => 'acl',
960922
'permissions' => $adminObjectAclData->getUserPermissions(),
@@ -1018,9 +980,6 @@ final public function setTwigGlobals(Request $request): void
1018980
*/
1019981
final protected function renderWithExtraParams(string $view, array $parameters = [], ?Response $response = null): Response
1020982
{
1021-
/**
1022-
* @psalm-suppress DeprecatedMethod
1023-
*/
1024983
return $this->render($view, $this->addRenderExtraParams($parameters), $response);
1025984
}
1026985

@@ -1036,9 +995,6 @@ final protected function renderWithExtraParams(string $view, array $parameters =
1036995
protected function addRenderExtraParams(array $parameters = []): array
1037996
{
1038997
$parameters['admin'] ??= $this->admin;
1039-
/**
1040-
* @psalm-suppress DeprecatedMethod
1041-
*/
1042998
$parameters['base_template'] ??= $this->getBaseTemplate();
1043999

10441000
return $parameters;

src/Datagrid/Datagrid.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,6 @@ private function buildForm(): FormInterface
357357
\E_USER_DEPRECATED
358358
);
359359

360-
/**
361-
* @psalm-suppress DeprecatedMethod
362-
*/
363360
[$type, $options] = $filter->getRenderSettings();
364361
}
365362

src/DependencyInjection/Admin/AbstractTaggedAdmin.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ public function __construct(?string $code = null, ?string $class = null, ?string
161161
$this->code = $code;
162162
}
163163

164-
/**
164+
/*
165165
* NEXT_MAJOR: Remove this assignment.
166-
*
167-
* @psalm-suppress DeprecatedProperty
168166
*/
169167
$this->class = $class;
170168

0 commit comments

Comments
 (0)