Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"require": {
"php": "~8.4.0 || ~8.5.0",
"doctrine/orm": "^2.20.9 || ^3.5.0",
"easycorp/easyadmin-bundle": "~4.29.16 || ~5.6.1 || ~5.7.0",
"easycorp/easyadmin-bundle": "~4.29.16 || ~5.6.1 || ~5.7.0 || ~5.8.0 || ~5.9.0",
"php-standard-library/php-standard-library": "^3.3.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
"symfony/config": "^6.4 || ^7.4 || ^8.0",
"symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0",
Expand All @@ -52,16 +52,16 @@
"twig/twig": "^3.27.0"
},
"require-dev": {
"carthage-software/mago": "^1.57.0",
"carthage-software/mago": "^1.59.0",
"doctrine/coding-standard": "^14.0.0",
"ergebnis/composer-normalize": "^2.54.0",
"ergebnis/composer-normalize": "^2.56.0",
"php-standard-library/phpstan-extension": "^2.1.0",
"phpstan/phpstan": "^2.2.16",
"phpstan/phpstan": "^2.3.5",
"phpstan/phpstan-deprecation-rules": "^2.0.5",
"phpstan/phpstan-phpunit": "^2.0.19",
"phpstan/phpstan-strict-rules": "^2.0.12",
"phpstan/phpstan-symfony": "^2.0.20",
"phpunit/phpunit": "^13.1.14",
"phpstan/phpstan-phpunit": "^2.1.1",
"phpstan/phpstan-strict-rules": "^2.1.1",
"phpstan/phpstan-symfony": "^2.1.1",
"phpunit/phpunit": "^13.4.6",
"roave/security-advisories": "dev-master",
"speicher210/functional-test-bundle": "^2.0.0",
"symfony/error-handler": "^6.4.44 || ^7.4.17 || ^8.1.5",
Expand Down
22 changes: 20 additions & 2 deletions config/mago-analyze-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,26 @@ count = 1
[[issues]]
file = 'src/Controller/BaseCrudDtoController.php'
code = 'mixed-method-access'
message = 'Attempting to access a method on a non-object type (`mixed`).'
count = 14
message = 'Attempting to call method `dispatch()` on a non-object type (`mixed`).'
count = 8

[[issues]]
file = 'src/Controller/BaseCrudDtoController.php'
code = 'mixed-method-access'
message = 'Attempting to call method `getManagerForClass()` on a non-object type (`mixed`).'
count = 2

[[issues]]
file = 'src/Controller/BaseCrudDtoController.php'
code = 'mixed-method-access'
message = 'Attempting to call method `processEntityActions()` on a non-object type (`mixed`).'
count = 2

[[issues]]
file = 'src/Controller/BaseCrudDtoController.php'
code = 'mixed-method-access'
message = 'Attempting to call method `processFields()` on a non-object type (`mixed`).'
count = 2

[[issues]]
file = 'src/Controller/BaseCrudDtoController.php'
Expand Down
19 changes: 13 additions & 6 deletions src/ProtungEasyAdminPlusBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Menu\MenuItemMatcherInterface;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Orm\EntityPaginatorInterface;
use EasyCorp\Bundle\EasyAdminBundle\DependencyInjection\EasyAdminExtension;
use EasyCorp\Bundle\EasyAdminBundle\Menu\MenuItemMatcher;
use Override;
use Protung\EasyAdminPlusBundle\Field\Configurator\CallbackConfigurableConfigurator;
Expand All @@ -23,6 +22,14 @@

final class ProtungEasyAdminPlusBundle extends AbstractBundle
{
/**
* EasyAdmin's own constants can't be used in every supported version: the ones of EasyAdminExtension are
* deprecated since EasyAdmin 5.7.1, and the ones of EasyAdminBundle that replace them only exist since 5.8.
*/
private const string TAG_FIELD_CONFIGURATOR = 'ea.field_configurator';

private const string TAG_FILTER_CONFIGURATOR = 'ea.filter_configurator';

/**
* @param array<mixed> $config
*/
Expand All @@ -32,7 +39,7 @@ public function loadExtension(array $config, ContainerConfigurator $configurator
$services = $configurator->services();

$services->defaults()->private()->autowire()->autoconfigure();
$services->instanceof(FieldConfiguratorInterface::class)->tag(EasyAdminExtension::TAG_FIELD_CONFIGURATOR);
$services->instanceof(FieldConfiguratorInterface::class)->tag(self::TAG_FIELD_CONFIGURATOR);
$services->instanceof(FormTypeInterface::class)->tag('form.type');
$services->alias(MenuItemMatcherInterface::class, MenuItemMatcher::class);

Expand All @@ -44,7 +51,7 @@ public function loadExtension(array $config, ContainerConfigurator $configurator
->autowire()
->autoconfigure()
->private()
->tag(EasyAdminExtension::TAG_FILTER_CONFIGURATOR, ['priority' => -1]); // must be after \EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator
->tag(self::TAG_FILTER_CONFIGURATOR, ['priority' => -1]); // must be after \EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator

$services->set(EntityPaginator::class)
->decorate(EntityPaginatorInterface::class)
Expand All @@ -61,18 +68,18 @@ public function loadExtension(array $config, ContainerConfigurator $configurator
->autowire()
->autoconfigure()
->private()
->tag(EasyAdminExtension::TAG_FIELD_CONFIGURATOR, ['priority' => 10_000]); // must be before \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPostConfigurator
->tag(self::TAG_FIELD_CONFIGURATOR, ['priority' => 10_000]); // must be before \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPostConfigurator

$services->set(CallbackConfigurableConfigurator::class)
->autowire()
->autoconfigure()
->private()
->tag(EasyAdminExtension::TAG_FIELD_CONFIGURATOR, ['priority' => 1]); // by design, we want this to kick in before any of the other field configurators with default priority
->tag(self::TAG_FIELD_CONFIGURATOR, ['priority' => 1]); // by design, we want this to kick in before any of the other field configurators with default priority

$services->set(CallbackConfigurableConfiguratorAfterCommonPostConfigurator::class)
->autowire()
->autoconfigure()
->private()
->tag(EasyAdminExtension::TAG_FIELD_CONFIGURATOR, ['priority' => -10_000]); // must be after \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPreConfigurator
->tag(self::TAG_FIELD_CONFIGURATOR, ['priority' => -10_000]); // must be after \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPreConfigurator
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span class="badge badge-secondary badge-variant-outline">Null</span>
10 changes: 9 additions & 1 deletion tests/Resources/Views/Crud/Field/JsonFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@

namespace Protung\EasyAdminPlusBundle\Tests\Resources\Views\Crud\Field;

use EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle;
use Generator;
use PHPUnit\Framework\Attributes\DataProvider;
use Protung\EasyAdminPlusBundle\Field\JsonField;
use Speicher210\FunctionalTestBundle\Test\Twig\TemplateTestCase;

use function version_compare;

final class JsonFieldTest extends TemplateTestCase
{
/**
* @return Generator<string, array<array<mixed>>>
*/
public static function dataProviderTestOutput(): Generator
{
yield 'no-data' => [[]];
// EasyAdmin 5.8 changed the CSS classes of the badge that the null label renders.
if (version_compare(EasyAdminBundle::VERSION, '5.8.0', '<')) {
yield 'no-data' => [[]];
} else {
yield 'no-data-since-easyadmin-5.8' => [[]];
}

yield 'with-value' => [
[
Expand Down
Loading