Skip to content

Commit 3b236d8

Browse files
authored
Merge 4.x into 5.x
2 parents 204403f + 1a3f8d1 commit 3b236d8

13 files changed

Lines changed: 36 additions & 20 deletions

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
5454
"phpstan/extension-installer": "^1.0",
5555
"phpstan/phpdoc-parser": "^1.0",
56-
"phpstan/phpstan": "^1.0",
57-
"phpstan/phpstan-phpunit": "^1.0",
58-
"phpstan/phpstan-strict-rules": "^1.0",
59-
"phpstan/phpstan-symfony": "^1.0",
56+
"phpstan/phpstan": "^1.0 || ^2.0",
57+
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
58+
"phpstan/phpstan-strict-rules": "^1.0 || ^2.0",
59+
"phpstan/phpstan-symfony": "^1.0 || ^2.0",
6060
"phpunit/phpunit": "^9.5",
61-
"psalm/plugin-phpunit": "^0.18",
61+
"psalm/plugin-phpunit": "^0.18 || ^0.19",
6262
"psalm/plugin-symfony": "^5.0",
63-
"rector/rector": "^1.1",
64-
"sonata-project/admin-bundle": "^4.34",
63+
"rector/rector": "^1.1 || ^2.0",
64+
"sonata-project/admin-bundle": "^4.35.4",
6565
"sonata-project/block-bundle": "^4.11 || ^5.0",
6666
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
6767
"symfony/asset": "^6.4 || ^7.1",
@@ -72,7 +72,7 @@
7272
"symfony/security-csrf": "^6.4 || ^7.1",
7373
"symfony/twig-bundle": "^6.4 || ^7.1",
7474
"symfony/yaml": "^6.4 || ^7.1",
75-
"vimeo/psalm": "^5.0"
75+
"vimeo/psalm": "^5.0 || ^6.10"
7676
},
7777
"conflict": {
7878
"doctrine/mongodb-odm": "<2.4",

phpstan-baseline.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ parameters:
1111
message: "#^Parameter \\#2 \\$category of method Sonata\\\\ClassificationBundle\\\\Form\\\\Type\\\\CategorySelectorType\\:\\:childWalker\\(\\) expects Sonata\\\\ClassificationBundle\\\\Model\\\\CategoryInterface, Sonata\\\\ClassificationBundle\\\\Model\\\\CategoryInterface\\|Sonata\\\\ClassificationBundle\\\\Model\\\\ContextInterface given\\.$#"
1212
count: 1
1313
path: src/Form/Type/CategorySelectorType.php
14+
-
15+
message: '#^Call to method get\(\) of internal class Symfony\\Bundle\\FrameworkBundle\\Test\\TestContainer from outside its root namespace Symfony.$#'
16+
path: tests/

psalm.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
1313
</plugins>
1414
<issueHandlers>
15-
<InternalMethod>
16-
<errorLevel type="suppress">
17-
<directory name="tests/Controller"/>
18-
</errorLevel>
19-
</InternalMethod>
2015
<MissingClassConstType errorLevel="suppress"/>
16+
<MissingOverrideAttribute errorLevel="suppress"/>
2117
</issueHandlers>
2218
</psalm>

src/DependencyInjection/SonataClassificationExtension.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ private function registerSonataDoctrineMapping(array $config): void
136136
);
137137

138138
$categoryCascade = ['persist', 'refresh', 'merge', 'detach'];
139-
$categoryIsEntity = \in_array(BaseCategory::class, class_parents($config['class']['category']), true);
140-
if ($categoryIsEntity && class_exists(EntityManager::class) && !method_exists(EntityManager::class, 'merge')) { // @phpstan-ignore-line
141-
unset($categoryCascade[array_search('merge', $categoryCascade, true)]);
139+
$parents = class_parents($config['class']['category']);
140+
if (false !== $parents) {
141+
$categoryIsEntity = \in_array(BaseCategory::class, $parents, true);
142+
if ($categoryIsEntity && class_exists(EntityManager::class) && !method_exists(EntityManager::class, 'merge')) { // @phpstan-ignore-line
143+
unset($categoryCascade[array_search('merge', $categoryCascade, true)]);
144+
}
142145
}
143146
$collector->addAssociation(
144147
$config['class']['category'],

tests/Admin/Filter/CategoryFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class CategoryFilterTest extends TestCase
3030

3131
protected function setUp(): void
3232
{
33-
$this->categoryManager = $this->createStub(CategoryManagerInterface::class);
33+
$this->categoryManager = static::createStub(CategoryManagerInterface::class);
3434
}
3535

3636
public function testRenderSettings(): void

tests/Admin/Filter/CollectionFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class CollectionFilterTest extends TestCase
2828

2929
protected function setUp(): void
3030
{
31-
$this->collectionManager = $this->createStub(CollectionManagerInterface::class);
31+
$this->collectionManager = static::createStub(CollectionManagerInterface::class);
3232
}
3333

3434
public function testRenderSettings(): void

tests/App/AppKernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Symfony\Component\HttpKernel\Kernel;
3434
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
3535
use Symfony\Component\Security\Http\Attribute\IsGranted;
36+
use Symfony\UX\StimulusBundle\StimulusBundle;
3637

3738
final class AppKernel extends Kernel
3839
{
@@ -54,6 +55,7 @@ public function registerBundles(): iterable
5455
new SonataDoctrineORMAdminBundle(),
5556
new SonataClassificationBundle(),
5657
new TwigBundle(),
58+
new StimulusBundle(),
5759
];
5860
}
5961

tests/App/Entity/Category.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use Doctrine\ORM\Mapping as ORM;
1818
use Sonata\ClassificationBundle\Entity\BaseCategory;
1919

20+
/**
21+
* @psalm-suppress ClassMustBeFinal
22+
*/
2023
#[ORM\Entity]
2124
#[ORM\Table(name: 'classification__category')]
2225
class Category extends BaseCategory

tests/App/Entity/Collection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use Doctrine\ORM\Mapping as ORM;
1818
use Sonata\ClassificationBundle\Entity\BaseCollection;
1919

20+
/**
21+
* @psalm-suppress ClassMustBeFinal
22+
*/
2023
#[ORM\Entity]
2124
#[ORM\Table(name: 'classification__collection')]
2225
class Collection extends BaseCollection

tests/App/Entity/Context.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use Doctrine\ORM\Mapping as ORM;
1818
use Sonata\ClassificationBundle\Entity\BaseContext;
1919

20+
/**
21+
* @psalm-suppress ClassMustBeFinal
22+
*/
2023
#[ORM\Entity]
2124
#[ORM\Table(name: 'classification__context')]
2225
class Context extends BaseContext

0 commit comments

Comments
 (0)