From 4cae78214f99857e9091173a414a68fa68b584b8 Mon Sep 17 00:00:00 2001 From: Michael Hirschler Date: Wed, 13 Nov 2024 11:20:42 +0100 Subject: [PATCH 1/6] Bugfix: fixes typo in `SimplePagerTest::testLastPage` (#8206) --- tests/Datagrid/SimplePagerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Datagrid/SimplePagerTest.php b/tests/Datagrid/SimplePagerTest.php index 3feee961c1..40703969dc 100644 --- a/tests/Datagrid/SimplePagerTest.php +++ b/tests/Datagrid/SimplePagerTest.php @@ -89,7 +89,7 @@ public function testInitOffset(): void static::assertSame(23, $this->pager->countResults()); } - public function testLasPage(): void + public function testLastPage(): void { $this->proxyQuery->expects(static::once()) ->method('execute') From f82eb213bcb6b1c151c3d0488aa1ad8e61bc6439 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 13 Nov 2024 11:45:52 +0100 Subject: [PATCH 2/6] Fix build (#8215) --- composer.json | 1 + rector.php | 2 ++ src/Action/AppendFormFieldElementAction.php | 2 +- src/Action/DashboardAction.php | 2 +- .../GetShortObjectDescriptionAction.php | 2 +- .../RetrieveAutocompleteItemsAction.php | 6 ++-- src/Action/RetrieveFormFieldElementAction.php | 2 +- src/Action/SearchAction.php | 2 +- src/Action/SetObjectFieldValueAction.php | 2 +- src/Admin/AbstractAdmin.php | 2 +- src/Admin/AbstractAdminExtension.php | 2 +- src/Admin/AdminExtensionInterface.php | 7 ++-- src/Admin/AdminHelper.php | 2 +- src/Admin/AdminInterface.php | 2 ++ src/Admin/BreadcrumbsBuilder.php | 4 +-- src/Admin/Pool.php | 2 +- src/Admin/UrlGeneratorInterface.php | 2 +- src/ArgumentResolver/AdminValueResolver.php | 2 +- src/Block/AdminListBlockService.php | 2 +- src/Block/AdminPreviewBlockService.php | 2 +- src/Block/AdminSearchBlockService.php | 2 +- src/Block/AdminStatsBlockService.php | 2 +- src/Bridge/Exporter/AdminExporter.php | 2 +- src/Builder/AbstractFormContractor.php | 2 +- src/Builder/DatagridBuilderInterface.php | 2 +- src/Builder/FormContractorInterface.php | 2 +- src/Builder/ListBuilderInterface.php | 2 +- src/Builder/ShowBuilderInterface.php | 2 +- src/Command/ExplainAdminCommand.php | 2 +- src/Command/GenerateObjectAclCommand.php | 2 +- src/Command/ListAdminCommand.php | 2 +- src/Command/QuestionableCommand.php | 4 +-- src/Command/SetupAclCommand.php | 2 +- src/Datagrid/Datagrid.php | 2 +- src/Datagrid/DatagridMapper.php | 4 +-- src/Datagrid/ListMapper.php | 2 +- src/Datagrid/SimplePager.php | 2 +- .../AbstractSonataAdminExtension.php | 2 +- .../AddDependencyCallsCompilerPass.php | 4 +-- .../Compiler/ExtensionCompilerPass.php | 2 +- src/Event/AdminEventExtension.php | 2 +- src/Event/BatchActionEvent.php | 2 +- src/Event/ConfigureEvent.php | 2 +- src/Event/ConfigureMenuEvent.php | 2 +- src/Event/ConfigureQueryEvent.php | 2 +- src/Event/PersistenceEvent.php | 2 +- .../BadRequestParamHttpException.php | 2 +- src/FieldDescription/BaseFieldDescription.php | 2 +- src/Filter/FilterFactory.php | 2 +- src/Filter/FilterInterface.php | 3 ++ src/Filter/Model/FilterData.php | 2 +- .../Persister/SessionFilterPersister.php | 2 +- src/Form/ChoiceList/ModelChoiceLoader.php | 2 +- .../ArrayToModelTransformer.php | 2 +- .../BooleanToStringTransformer.php | 2 +- .../ModelToIdPropertyTransformer.php | 2 +- .../DataTransformer/ModelToIdTransformer.php | 2 +- .../ModelsToArrayTransformer.php | 2 +- src/Form/DataTransformerResolver.php | 2 +- src/Form/DataTransformerResolverInterface.php | 2 +- .../Field/Type/FormTypeFieldExtension.php | 2 +- src/Form/FormMapper.php | 2 +- src/Form/Type/ModelType.php | 2 +- src/Maker/AdminMaker.php | 8 ++--- src/Manipulator/ObjectManipulator.php | 4 +-- src/Manipulator/ServicesManipulator.php | 2 +- src/Menu/Matcher/Voter/AdminVoter.php | 2 +- src/Menu/MenuBuilder.php | 2 +- src/Menu/Provider/GroupMenuProvider.php | 2 +- src/Model/AuditManager.php | 2 +- src/Model/Revision.php | 2 +- src/Object/Metadata.php | 2 +- src/Request/AdminFetcher.php | 2 +- src/Route/AdminPoolLoader.php | 2 +- src/Route/DefaultRouteGenerator.php | 6 ++-- src/Route/PathInfoBuilder.php | 2 +- src/Route/RouteCollection.php | 4 +-- src/Route/RouteCollectionInterface.php | 2 +- src/Route/RoutesCache.php | 2 +- src/Route/RoutesCacheWarmUp.php | 2 +- src/Security/Handler/AclSecurityHandler.php | 2 +- src/Security/Handler/RoleSecurityHandler.php | 2 +- src/Show/ShowMapper.php | 2 +- src/SonataConfiguration.php | 2 +- src/Translator/Extractor/AdminExtractor.php | 2 +- src/Twig/BreadcrumbsRuntime.php | 6 ++-- src/Twig/CanonicalizeRuntime.php | 2 +- src/Twig/Extension/BreadcrumbsExtension.php | 6 ++-- src/Twig/Extension/CanonicalizeExtension.php | 2 +- src/Twig/Extension/GroupExtension.php | 2 +- src/Twig/Extension/IconExtension.php | 2 +- src/Twig/Extension/RenderElementExtension.php | 8 ++--- src/Twig/Extension/SecurityExtension.php | 2 +- src/Twig/Extension/SonataAdminExtension.php | 2 +- .../Extension/TemplateRegistryExtension.php | 2 +- src/Twig/Extension/XEditableExtension.php | 2 +- src/Twig/GroupRuntime.php | 2 +- src/Twig/RenderElementRuntime.php | 14 ++++---- src/Twig/SecurityRuntime.php | 2 +- src/Twig/SonataAdminRuntime.php | 2 +- src/Twig/TemplateRegistryRuntime.php | 2 +- src/Twig/XEditableRuntime.php | 2 +- src/Util/AdminAclManipulator.php | 4 +-- src/Util/AdminAclManipulatorInterface.php | 2 +- src/Util/AdminObjectAclData.php | 2 +- src/Util/AdminObjectAclManipulator.php | 2 +- src/Util/FormBuilderIterator.php | 2 +- src/Util/ObjectAclManipulator.php | 2 +- src/Util/ObjectAclManipulatorInterface.php | 2 +- .../AppendFormFieldElementActionTest.php | 2 +- .../RetrieveFormFieldElementActionTest.php | 2 +- .../Action/SetObjectFieldValueActionTest.php | 2 +- tests/Admin/Extension/LockExtensionTest.php | 2 +- tests/App/Builder/DatagridBuilder.php | 2 +- tests/App/Datagrid/Pager.php | 2 +- tests/App/Model/Bar.php | 2 +- tests/App/Model/BarRepository.php | 2 +- tests/App/Model/Baz.php | 2 +- tests/App/Model/Foo.php | 7 +++- tests/App/Model/ModelManager.php | 2 +- tests/Controller/CRUDControllerTest.php | 34 +++++++++---------- tests/Datagrid/DatagridMapperTest.php | 2 +- tests/Datagrid/ListMapperTest.php | 2 +- .../ConfigureCRUDControllerListenerTest.php | 4 +-- tests/Fixtures/Entity/Entity.php | 2 +- .../Mapper/AbstractDummyGroupedMapper.php | 2 +- tests/Fixtures/TestExtension.php | 2 +- tests/Form/FormMapperTest.php | 2 +- tests/Menu/Matcher/Voter/AdminVoterTest.php | 4 +-- tests/Menu/Provider/GroupMenuProviderTest.php | 10 +++--- tests/Route/DefaultRouteGeneratorTest.php | 2 +- .../Handler/AclSecurityHandlerTest.php | 4 +-- .../Handler/RoleSecurityHandlerTest.php | 2 +- tests/Show/ShowMapperTest.php | 2 +- .../Extension/RenderElementExtensionTest.php | 2 +- tests/Twig/RenderElementRuntimeTest.php | 2 +- 136 files changed, 199 insertions(+), 183 deletions(-) diff --git a/composer.json b/composer.json index 65c0372aa8..ba0943f39f 100644 --- a/composer.json +++ b/composer.json @@ -71,6 +71,7 @@ "matthiasnoback/symfony-config-test": "^4.2 || ^5.0", "matthiasnoback/symfony-dependency-injection-test": "^4.2 || ^5.0", "phpstan/extension-installer": "^1.0", + "phpstan/phpdoc-parser": "^1.0", "phpstan/phpstan": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", diff --git a/rector.php b/rector.php index b6dac16fc2..744632387a 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -40,5 +41,6 @@ $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, PreferPHPUnitThisCallRector::class, + NarrowUnusedSetUpDefinedPropertyRector::class, ]); }; diff --git a/src/Action/AppendFormFieldElementAction.php b/src/Action/AppendFormFieldElementAction.php index 760bbba1ff..3da89a2905 100644 --- a/src/Action/AppendFormFieldElementAction.php +++ b/src/Action/AppendFormFieldElementAction.php @@ -27,7 +27,7 @@ final class AppendFormFieldElementAction public function __construct( private Environment $twig, private AdminFetcherInterface $adminFetcher, - private AdminHelper $helper + private AdminHelper $helper, ) { } diff --git a/src/Action/DashboardAction.php b/src/Action/DashboardAction.php index 53ec367f16..0d0e420adb 100644 --- a/src/Action/DashboardAction.php +++ b/src/Action/DashboardAction.php @@ -26,7 +26,7 @@ final class DashboardAction public function __construct( private array $dashboardBlocks, private TemplateRegistryInterface $templateRegistry, - private Environment $twig + private Environment $twig, ) { } diff --git a/src/Action/GetShortObjectDescriptionAction.php b/src/Action/GetShortObjectDescriptionAction.php index 17ada5bc75..4440181507 100644 --- a/src/Action/GetShortObjectDescriptionAction.php +++ b/src/Action/GetShortObjectDescriptionAction.php @@ -26,7 +26,7 @@ final class GetShortObjectDescriptionAction { public function __construct( private Environment $twig, - private AdminFetcherInterface $adminFetcher + private AdminFetcherInterface $adminFetcher, ) { } diff --git a/src/Action/RetrieveAutocompleteItemsAction.php b/src/Action/RetrieveAutocompleteItemsAction.php index 88a6796835..0d7e1ec535 100644 --- a/src/Action/RetrieveAutocompleteItemsAction.php +++ b/src/Action/RetrieveAutocompleteItemsAction.php @@ -31,7 +31,7 @@ final class RetrieveAutocompleteItemsAction { public function __construct( - private AdminFetcherInterface $adminFetcher + private AdminFetcherInterface $adminFetcher, ) { } @@ -232,7 +232,7 @@ public function __invoke(Request $request): JsonResponse */ private function retrieveFilterFieldDescription( AdminInterface $admin, - string $field + string $field, ): FieldDescriptionInterface { if (!$admin->hasFilterFieldDescription($field)) { throw new \RuntimeException(\sprintf('The field "%s" does not exist.', $field)); @@ -256,7 +256,7 @@ private function retrieveFilterFieldDescription( */ private function retrieveFormFieldDescription( AdminInterface $admin, - string $field + string $field, ): FieldDescriptionInterface { if (!$admin->hasFormFieldDescription($field)) { throw new \RuntimeException(\sprintf('The field "%s" does not exist.', $field)); diff --git a/src/Action/RetrieveFormFieldElementAction.php b/src/Action/RetrieveFormFieldElementAction.php index 93b903882e..97b3fd4a89 100644 --- a/src/Action/RetrieveFormFieldElementAction.php +++ b/src/Action/RetrieveFormFieldElementAction.php @@ -27,7 +27,7 @@ final class RetrieveFormFieldElementAction public function __construct( private Environment $twig, private AdminFetcherInterface $adminFetcher, - private AdminHelper $helper + private AdminHelper $helper, ) { } diff --git a/src/Action/SearchAction.php b/src/Action/SearchAction.php index a144e28d18..111eaa637e 100644 --- a/src/Action/SearchAction.php +++ b/src/Action/SearchAction.php @@ -24,7 +24,7 @@ final class SearchAction public function __construct( private Pool $pool, private TemplateRegistryInterface $templateRegistry, - private Environment $twig + private Environment $twig, ) { } diff --git a/src/Action/SetObjectFieldValueAction.php b/src/Action/SetObjectFieldValueAction.php index 0bbc00be8a..5337b9da43 100644 --- a/src/Action/SetObjectFieldValueAction.php +++ b/src/Action/SetObjectFieldValueAction.php @@ -38,7 +38,7 @@ public function __construct( private ValidatorInterface $validator, private DataTransformerResolverInterface $resolver, private PropertyAccessorInterface $propertyAccessor, - ?RenderElementRuntime $renderElementRuntime = null + ?RenderElementRuntime $renderElementRuntime = null, ) { // NEXT_MAJOR: Remove the deprecation and restrict param constructor to RenderElementRuntime. if (null === $renderElementRuntime) { diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index f75ac38666..41dc1e4226 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -1370,7 +1370,7 @@ final public function isChild(): bool /** * Returns true if the admin has children, false otherwise. * - * @phpstan-assert-if-true non-empty-array $this->children + * @phpstan-assert-if-true non-empty-array> $this->children */ final public function hasChildren(): bool { diff --git a/src/Admin/AbstractAdminExtension.php b/src/Admin/AbstractAdminExtension.php index d4a9044ccd..af79346ff5 100644 --- a/src/Admin/AbstractAdminExtension.php +++ b/src/Admin/AbstractAdminExtension.php @@ -141,7 +141,7 @@ public function configureActionButtons( AdminInterface $admin, array $list, string $action, - ?object $object = null + ?object $object = null, ): array { return $list; } diff --git a/src/Admin/AdminExtensionInterface.php b/src/Admin/AdminExtensionInterface.php index 5ef7acc02e..c4d06907fd 100644 --- a/src/Admin/AdminExtensionInterface.php +++ b/src/Admin/AdminExtensionInterface.php @@ -28,6 +28,8 @@ * * @method void preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements) * + * @phpstan-method void preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements) + * * @phpstan-template T of object */ interface AdminExtensionInterface @@ -68,7 +70,7 @@ public function configureTabMenu( AdminInterface $admin, MenuItemInterface $menu, string $action, - ?AdminInterface $childAdmin = null + ?AdminInterface $childAdmin = null, ): void; /** @@ -137,6 +139,7 @@ public function configureBatchActions(AdminInterface $admin, array $actions): ar // /** // * @param mixed[] $idx // * @phpstan-param AdminInterface $admin + // * @phpstan-param ProxyQueryInterface $query // */ // public function preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements): void; @@ -203,7 +206,7 @@ public function configureActionButtons( AdminInterface $admin, array $list, string $action, - ?object $object = null + ?object $object = null, ): array; /** diff --git a/src/Admin/AdminHelper.php b/src/Admin/AdminHelper.php index c96f2e6c74..85603cfd1a 100644 --- a/src/Admin/AdminHelper.php +++ b/src/Admin/AdminHelper.php @@ -36,7 +36,7 @@ class AdminHelper private const FORM_FIELD_DELETE = '_delete'; public function __construct( - private PropertyAccessorInterface $propertyAccessor + private PropertyAccessorInterface $propertyAccessor, ) { } diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index eb92167643..af130c9558 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -33,6 +33,8 @@ * @method bool showInDashboard() * @method void removeExtension(AdminExtensionInterface $extension) * + * @phpstan-method void removeExtension(AdminExtensionInterface $extension) + * * @phpstan-import-type FieldDescriptionOptions from FieldDescriptionInterface * * @phpstan-template T of object diff --git a/src/Admin/BreadcrumbsBuilder.php b/src/Admin/BreadcrumbsBuilder.php index 817b1e56a6..6e441debc4 100644 --- a/src/Admin/BreadcrumbsBuilder.php +++ b/src/Admin/BreadcrumbsBuilder.php @@ -75,7 +75,7 @@ public function getBreadcrumbs(AdminInterface $admin, string $action): array public function buildBreadcrumbs( AdminInterface $admin, string $action, - ?ItemInterface $menu = null + ?ItemInterface $menu = null, ): ItemInterface { if (null === $menu) { $menu = $admin->getMenuFactory()->createItem('root'); @@ -161,7 +161,7 @@ private function createMenuItem( ItemInterface $menu, string $name, ?string $translationDomain = null, - array $options = [] + array $options = [], ): ItemInterface { $options = array_merge([ 'extras' => [ diff --git a/src/Admin/Pool.php b/src/Admin/Pool.php index b81b8c18e7..d9087a946e 100644 --- a/src/Admin/Pool.php +++ b/src/Admin/Pool.php @@ -62,7 +62,7 @@ public function __construct( private ContainerInterface $container, private array $adminServiceCodes = [], private array $adminGroups = [], - private array $adminClasses = [] + private array $adminClasses = [], ) { } diff --git a/src/Admin/UrlGeneratorInterface.php b/src/Admin/UrlGeneratorInterface.php index 386ba845c8..578c4a660a 100644 --- a/src/Admin/UrlGeneratorInterface.php +++ b/src/Admin/UrlGeneratorInterface.php @@ -51,7 +51,7 @@ public function generateObjectUrl( string $name, object $object, array $parameters = [], - int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH + int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH, ): string; /** diff --git a/src/ArgumentResolver/AdminValueResolver.php b/src/ArgumentResolver/AdminValueResolver.php index 9d492352d8..73a9ef6f44 100644 --- a/src/ArgumentResolver/AdminValueResolver.php +++ b/src/ArgumentResolver/AdminValueResolver.php @@ -21,7 +21,7 @@ final class AdminValueResolver implements CompatibleValueResolverInterface { public function __construct( - private AdminFetcherInterface $adminFetcher + private AdminFetcherInterface $adminFetcher, ) { } diff --git a/src/Block/AdminListBlockService.php b/src/Block/AdminListBlockService.php index 8c116face5..cd25ee74c1 100644 --- a/src/Block/AdminListBlockService.php +++ b/src/Block/AdminListBlockService.php @@ -29,7 +29,7 @@ final class AdminListBlockService extends AbstractBlockService public function __construct( Environment $twig, private Pool $pool, - private TemplateRegistryInterface $templateRegistry + private TemplateRegistryInterface $templateRegistry, ) { parent::__construct($twig); } diff --git a/src/Block/AdminPreviewBlockService.php b/src/Block/AdminPreviewBlockService.php index 3af05a649f..9e8d59ad2e 100644 --- a/src/Block/AdminPreviewBlockService.php +++ b/src/Block/AdminPreviewBlockService.php @@ -31,7 +31,7 @@ final class AdminPreviewBlockService extends AbstractBlockService { public function __construct( Environment $twig, - private Pool $pool + private Pool $pool, ) { parent::__construct($twig); } diff --git a/src/Block/AdminSearchBlockService.php b/src/Block/AdminSearchBlockService.php index 674715ef7e..418695a297 100644 --- a/src/Block/AdminSearchBlockService.php +++ b/src/Block/AdminSearchBlockService.php @@ -40,7 +40,7 @@ public function __construct( private SearchHandlerInterface $searchHandler, private TemplateRegistryInterface $templateRegistry, private string $emptyBoxesOption, - private string $adminRoute + private string $adminRoute, ) { parent::__construct($twig); } diff --git a/src/Block/AdminStatsBlockService.php b/src/Block/AdminStatsBlockService.php index 4b375861b3..5e675dea06 100644 --- a/src/Block/AdminStatsBlockService.php +++ b/src/Block/AdminStatsBlockService.php @@ -28,7 +28,7 @@ final class AdminStatsBlockService extends AbstractBlockService { public function __construct( Environment $twig, - private Pool $pool + private Pool $pool, ) { parent::__construct($twig); } diff --git a/src/Bridge/Exporter/AdminExporter.php b/src/Bridge/Exporter/AdminExporter.php index bbae8ada05..b85f5944a9 100644 --- a/src/Bridge/Exporter/AdminExporter.php +++ b/src/Bridge/Exporter/AdminExporter.php @@ -22,7 +22,7 @@ final class AdminExporter { public function __construct( - private ExporterInterface $exporter + private ExporterInterface $exporter, ) { } diff --git a/src/Builder/AbstractFormContractor.php b/src/Builder/AbstractFormContractor.php index 99042a5681..ac0681910b 100644 --- a/src/Builder/AbstractFormContractor.php +++ b/src/Builder/AbstractFormContractor.php @@ -69,7 +69,7 @@ final public function getFormBuilder(string $name, array $formOptions = []): For final public function getDefaultOptions( ?string $type, FieldDescriptionInterface $fieldDescription, - array $formOptions = [] + array $formOptions = [], ): array { $options = []; $options['sonata_field_description'] = $fieldDescription; diff --git a/src/Builder/DatagridBuilderInterface.php b/src/Builder/DatagridBuilderInterface.php index 04c1c06b01..7c3477d62b 100644 --- a/src/Builder/DatagridBuilderInterface.php +++ b/src/Builder/DatagridBuilderInterface.php @@ -33,7 +33,7 @@ interface DatagridBuilderInterface extends BuilderInterface public function addFilter( DatagridInterface $datagrid, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void; /** diff --git a/src/Builder/FormContractorInterface.php b/src/Builder/FormContractorInterface.php index 543f106b00..2ae119aa65 100644 --- a/src/Builder/FormContractorInterface.php +++ b/src/Builder/FormContractorInterface.php @@ -45,6 +45,6 @@ public function getFormBuilder(string $name, array $formOptions = []): FormBuild public function getDefaultOptions( ?string $type, FieldDescriptionInterface $fieldDescription, - array $formOptions = [] + array $formOptions = [], ): array; } diff --git a/src/Builder/ListBuilderInterface.php b/src/Builder/ListBuilderInterface.php index 586bd6e695..3d3af8c1b3 100644 --- a/src/Builder/ListBuilderInterface.php +++ b/src/Builder/ListBuilderInterface.php @@ -43,6 +43,6 @@ public function buildField(?string $type, FieldDescriptionInterface $fieldDescri public function addField( FieldDescriptionCollection $list, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void; } diff --git a/src/Builder/ShowBuilderInterface.php b/src/Builder/ShowBuilderInterface.php index b41d4b2b0a..830d7a97bc 100644 --- a/src/Builder/ShowBuilderInterface.php +++ b/src/Builder/ShowBuilderInterface.php @@ -36,6 +36,6 @@ public function getBaseList(array $options = []): FieldDescriptionCollection; public function addField( FieldDescriptionCollection $list, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void; } diff --git a/src/Command/ExplainAdminCommand.php b/src/Command/ExplainAdminCommand.php index 706d455089..a13878575e 100644 --- a/src/Command/ExplainAdminCommand.php +++ b/src/Command/ExplainAdminCommand.php @@ -30,7 +30,7 @@ final class ExplainAdminCommand extends Command * @internal This class should only be used through the console */ public function __construct( - private Pool $pool + private Pool $pool, ) { parent::__construct(); } diff --git a/src/Command/GenerateObjectAclCommand.php b/src/Command/GenerateObjectAclCommand.php index 542ff06447..4ab81ce901 100644 --- a/src/Command/GenerateObjectAclCommand.php +++ b/src/Command/GenerateObjectAclCommand.php @@ -37,7 +37,7 @@ final class GenerateObjectAclCommand extends QuestionableCommand */ public function __construct( private Pool $pool, - private array $aclObjectManipulators + private array $aclObjectManipulators, ) { parent::__construct(); } diff --git a/src/Command/ListAdminCommand.php b/src/Command/ListAdminCommand.php index 43c50ce336..5d2bbcea1a 100644 --- a/src/Command/ListAdminCommand.php +++ b/src/Command/ListAdminCommand.php @@ -29,7 +29,7 @@ final class ListAdminCommand extends Command * @internal This class should only be used through the console */ public function __construct( - private Pool $pool + private Pool $pool, ) { parent::__construct(); } diff --git a/src/Command/QuestionableCommand.php b/src/Command/QuestionableCommand.php index 3f72c092c1..d05dd290c5 100644 --- a/src/Command/QuestionableCommand.php +++ b/src/Command/QuestionableCommand.php @@ -34,7 +34,7 @@ final protected function askAndValidate( OutputInterface $output, string $questionText, string $default, - callable $validator + callable $validator, ) { $questionHelper = $this->getQuestionHelper(); @@ -49,7 +49,7 @@ final protected function askConfirmation( InputInterface $input, OutputInterface $output, string $questionText, - string $default + string $default, ): bool { $questionHelper = $this->getQuestionHelper(); $question = new ConfirmationQuestion( diff --git a/src/Command/SetupAclCommand.php b/src/Command/SetupAclCommand.php index 92e87caade..59cb339941 100644 --- a/src/Command/SetupAclCommand.php +++ b/src/Command/SetupAclCommand.php @@ -31,7 +31,7 @@ final class SetupAclCommand extends Command */ public function __construct( private Pool $pool, - private AdminAclManipulatorInterface $aclManipulator + private AdminAclManipulatorInterface $aclManipulator, ) { parent::__construct(); } diff --git a/src/Datagrid/Datagrid.php b/src/Datagrid/Datagrid.php index 1be26d43f5..66b0ff2f89 100644 --- a/src/Datagrid/Datagrid.php +++ b/src/Datagrid/Datagrid.php @@ -62,7 +62,7 @@ public function __construct( private FieldDescriptionCollection $columns, private PagerInterface $pager, private FormBuilderInterface $formBuilder, - private array $values = [] + private array $values = [], ) { } diff --git a/src/Datagrid/DatagridMapper.php b/src/Datagrid/DatagridMapper.php index ffbacffe20..63cf81ac59 100644 --- a/src/Datagrid/DatagridMapper.php +++ b/src/Datagrid/DatagridMapper.php @@ -39,7 +39,7 @@ final class DatagridMapper implements MapperInterface public function __construct( private DatagridBuilderInterface $builder, private DatagridInterface $datagrid, - private AdminInterface $admin + private AdminInterface $admin, ) { } @@ -63,7 +63,7 @@ public function add( string $name, ?string $type = null, array $filterOptions = [], - array $fieldDescriptionOptions = [] + array $fieldDescriptionOptions = [], ): self { if ( isset($fieldDescriptionOptions['role']) diff --git a/src/Datagrid/ListMapper.php b/src/Datagrid/ListMapper.php index bf699c60e1..d85c19dd0c 100644 --- a/src/Datagrid/ListMapper.php +++ b/src/Datagrid/ListMapper.php @@ -48,7 +48,7 @@ final class ListMapper implements MapperInterface public function __construct( private ListBuilderInterface $builder, private FieldDescriptionCollection $list, - private AdminInterface $admin + private AdminInterface $admin, ) { } diff --git a/src/Datagrid/SimplePager.php b/src/Datagrid/SimplePager.php index 582da46d39..1414c34b73 100644 --- a/src/Datagrid/SimplePager.php +++ b/src/Datagrid/SimplePager.php @@ -46,7 +46,7 @@ final class SimplePager extends Pager */ public function __construct( int $maxPerPage = 10, - private int $threshold = 1 + private int $threshold = 1, ) { parent::__construct($maxPerPage); } diff --git a/src/DependencyInjection/AbstractSonataAdminExtension.php b/src/DependencyInjection/AbstractSonataAdminExtension.php index dfe2dca7b4..7a103fcd41 100644 --- a/src/DependencyInjection/AbstractSonataAdminExtension.php +++ b/src/DependencyInjection/AbstractSonataAdminExtension.php @@ -32,7 +32,7 @@ abstract class AbstractSonataAdminExtension extends Extension protected function fixTemplatesConfiguration( array $configs, ContainerBuilder $container, - array $defaultSonataDoctrineConfig = [] + array $defaultSonataDoctrineConfig = [], ): array { $defaultConfig = [ 'templates' => [ diff --git a/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php b/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php index 8a911ab9b6..48b1e2ac0f 100644 --- a/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php +++ b/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php @@ -465,7 +465,7 @@ private function getDefaultMethodCalls(ContainerBuilder $container, string $serv private function fixTemplates( string $serviceId, ContainerBuilder $container, - Definition $definition + Definition $definition, ): void { $definedTemplates = $container->getParameter('sonata.admin.configuration.templates'); \assert(\is_array($definedTemplates)); @@ -527,7 +527,7 @@ private function fixTemplates( private function replaceDefaultArguments( array $defaultArguments, Definition $definition, - ?Definition $parentDefinition = null + ?Definition $parentDefinition = null, ): void { $arguments = $definition->getArguments(); $parentArguments = null !== $parentDefinition ? $parentDefinition->getArguments() : []; diff --git a/src/DependencyInjection/Compiler/ExtensionCompilerPass.php b/src/DependencyInjection/Compiler/ExtensionCompilerPass.php index b1ae7f85ba..9efeda54be 100644 --- a/src/DependencyInjection/Compiler/ExtensionCompilerPass.php +++ b/src/DependencyInjection/Compiler/ExtensionCompilerPass.php @@ -380,7 +380,7 @@ private function addExtension( array &$targets, string $target, string $extension, - array $attributes + array $attributes, ): void { if (!isset($targets[$target])) { /** @phpstan-var \SplPriorityQueue $queue */ diff --git a/src/Event/AdminEventExtension.php b/src/Event/AdminEventExtension.php index 590e27514a..1eb9c031f3 100644 --- a/src/Event/AdminEventExtension.php +++ b/src/Event/AdminEventExtension.php @@ -30,7 +30,7 @@ final class AdminEventExtension extends AbstractAdminExtension { public function __construct( - private EventDispatcherInterface $eventDispatcher + private EventDispatcherInterface $eventDispatcher, ) { } diff --git a/src/Event/BatchActionEvent.php b/src/Event/BatchActionEvent.php index af278b8081..953584fc5e 100644 --- a/src/Event/BatchActionEvent.php +++ b/src/Event/BatchActionEvent.php @@ -50,7 +50,7 @@ public function __construct( private string $actionName, private ProxyQueryInterface $proxyQuery, array &$idx, - private bool $allElements + private bool $allElements, ) { $this->idx = &$idx; } diff --git a/src/Event/ConfigureEvent.php b/src/Event/ConfigureEvent.php index 0724df0c1c..42a09f772e 100644 --- a/src/Event/ConfigureEvent.php +++ b/src/Event/ConfigureEvent.php @@ -49,7 +49,7 @@ final class ConfigureEvent extends Event public function __construct( private AdminInterface $admin, private MapperInterface $mapper, - private string $type + private string $type, ) { } diff --git a/src/Event/ConfigureMenuEvent.php b/src/Event/ConfigureMenuEvent.php index e0b05e2f9e..ee7c635155 100644 --- a/src/Event/ConfigureMenuEvent.php +++ b/src/Event/ConfigureMenuEvent.php @@ -28,7 +28,7 @@ final class ConfigureMenuEvent extends Event public function __construct( private FactoryInterface $factory, - private ItemInterface $menu + private ItemInterface $menu, ) { } diff --git a/src/Event/ConfigureQueryEvent.php b/src/Event/ConfigureQueryEvent.php index 3a5f7a1ed9..2d9282c6d4 100644 --- a/src/Event/ConfigureQueryEvent.php +++ b/src/Event/ConfigureQueryEvent.php @@ -36,7 +36,7 @@ final class ConfigureQueryEvent extends Event public function __construct( private AdminInterface $admin, private ProxyQueryInterface $proxyQuery, - private string $context + private string $context, ) { } diff --git a/src/Event/PersistenceEvent.php b/src/Event/PersistenceEvent.php index 0fb187c74d..0a3f085ba5 100644 --- a/src/Event/PersistenceEvent.php +++ b/src/Event/PersistenceEvent.php @@ -48,7 +48,7 @@ final class PersistenceEvent extends Event public function __construct( private AdminInterface $admin, private object $object, - private string $type + private string $type, ) { } diff --git a/src/Exception/BadRequestParamHttpException.php b/src/Exception/BadRequestParamHttpException.php index 368e1e0454..887c8cc6ed 100644 --- a/src/Exception/BadRequestParamHttpException.php +++ b/src/Exception/BadRequestParamHttpException.php @@ -26,7 +26,7 @@ final class BadRequestParamHttpException extends BadRequestHttpException public function __construct( string $name, $expectedTypes, - mixed $value + mixed $value, ) { if (!\is_array($expectedTypes)) { $expectedTypes = [$expectedTypes]; diff --git a/src/FieldDescription/BaseFieldDescription.php b/src/FieldDescription/BaseFieldDescription.php index 397da240dd..d4cca3edda 100644 --- a/src/FieldDescription/BaseFieldDescription.php +++ b/src/FieldDescription/BaseFieldDescription.php @@ -137,7 +137,7 @@ public function __construct( array $fieldMapping = [], array $associationMapping = [], array $parentAssociationMappings = [], - ?string $fieldName = null + ?string $fieldName = null, ) { $this->setName($name); diff --git a/src/Filter/FilterFactory.php b/src/Filter/FilterFactory.php index f4185a61c4..b903c2932a 100644 --- a/src/Filter/FilterFactory.php +++ b/src/Filter/FilterFactory.php @@ -21,7 +21,7 @@ final class FilterFactory implements FilterFactoryInterface { public function __construct( - private ContainerInterface $container + private ContainerInterface $container, ) { } diff --git a/src/Filter/FilterInterface.php b/src/Filter/FilterInterface.php index d0f59b5c58..19a1741d68 100644 --- a/src/Filter/FilterInterface.php +++ b/src/Filter/FilterInterface.php @@ -23,6 +23,9 @@ * @method bool|null showFilter(); * @method array getLabelTranslationParameters(); * @method bool withAdvancedFilter(); + * + * @phpstan-method array getFormOptions(); + * @phpstan-method array getLabelTranslationParameters(); */ interface FilterInterface { diff --git a/src/Filter/Model/FilterData.php b/src/Filter/Model/FilterData.php index 6ca23f0a65..346925a12b 100644 --- a/src/Filter/Model/FilterData.php +++ b/src/Filter/Model/FilterData.php @@ -31,7 +31,7 @@ final class FilterData private function __construct( private ?int $type, private bool $hasValue, - mixed $value = null + mixed $value = null, ) { if ($hasValue) { $this->value = $value; diff --git a/src/Filter/Persister/SessionFilterPersister.php b/src/Filter/Persister/SessionFilterPersister.php index 86a97d0d20..1808c1b57f 100644 --- a/src/Filter/Persister/SessionFilterPersister.php +++ b/src/Filter/Persister/SessionFilterPersister.php @@ -24,7 +24,7 @@ final class SessionFilterPersister implements FilterPersisterInterface { public function __construct( - private RequestStack $requestStack + private RequestStack $requestStack, ) { } diff --git a/src/Form/ChoiceList/ModelChoiceLoader.php b/src/Form/ChoiceList/ModelChoiceLoader.php index fb38afa792..c6d4a31a56 100644 --- a/src/Form/ChoiceList/ModelChoiceLoader.php +++ b/src/Form/ChoiceList/ModelChoiceLoader.php @@ -40,7 +40,7 @@ public function __construct( private string $class, private ?string $property = null, private ?object $query = null, - private ?array $choices = null + private ?array $choices = null, ) { if (null !== $query && !$this->modelManager->supportsQuery($query)) { throw new InvalidArgumentException('The model manager does not support the query.'); diff --git a/src/Form/DataTransformer/ArrayToModelTransformer.php b/src/Form/DataTransformer/ArrayToModelTransformer.php index a840e6538e..37cc2c40fe 100644 --- a/src/Form/DataTransformer/ArrayToModelTransformer.php +++ b/src/Form/DataTransformer/ArrayToModelTransformer.php @@ -31,7 +31,7 @@ final class ArrayToModelTransformer implements DataTransformerInterface */ public function __construct( private ModelManagerInterface $modelManager, - private string $className + private string $className, ) { } diff --git a/src/Form/DataTransformer/BooleanToStringTransformer.php b/src/Form/DataTransformer/BooleanToStringTransformer.php index 1b31f9cc38..5bd2cf82a4 100644 --- a/src/Form/DataTransformer/BooleanToStringTransformer.php +++ b/src/Form/DataTransformer/BooleanToStringTransformer.php @@ -26,7 +26,7 @@ final class BooleanToStringTransformer implements DataTransformerInterface { public function __construct( - private string $trueValue + private string $trueValue, ) { } diff --git a/src/Form/DataTransformer/ModelToIdPropertyTransformer.php b/src/Form/DataTransformer/ModelToIdPropertyTransformer.php index 4b22c05cc4..3e831a8354 100644 --- a/src/Form/DataTransformer/ModelToIdPropertyTransformer.php +++ b/src/Form/DataTransformer/ModelToIdPropertyTransformer.php @@ -52,7 +52,7 @@ public function __construct( private string $className, private $property, private bool $multiple = false, - ?callable $toStringCallback = null + ?callable $toStringCallback = null, ) { if ('' === $property) { throw new InvalidArgumentException('The property must be non empty.'); diff --git a/src/Form/DataTransformer/ModelToIdTransformer.php b/src/Form/DataTransformer/ModelToIdTransformer.php index e2534fc720..0cc6b41648 100644 --- a/src/Form/DataTransformer/ModelToIdTransformer.php +++ b/src/Form/DataTransformer/ModelToIdTransformer.php @@ -30,7 +30,7 @@ final class ModelToIdTransformer implements DataTransformerInterface */ public function __construct( private ModelManagerInterface $modelManager, - private string $className + private string $className, ) { } diff --git a/src/Form/DataTransformer/ModelsToArrayTransformer.php b/src/Form/DataTransformer/ModelsToArrayTransformer.php index 128bab53e4..d82aa7d9cd 100644 --- a/src/Form/DataTransformer/ModelsToArrayTransformer.php +++ b/src/Form/DataTransformer/ModelsToArrayTransformer.php @@ -34,7 +34,7 @@ final class ModelsToArrayTransformer implements DataTransformerInterface */ public function __construct( private ModelManagerInterface $modelManager, - private string $class + private string $class, ) { } diff --git a/src/Form/DataTransformerResolver.php b/src/Form/DataTransformerResolver.php index 6a8bbc7cec..d5ef693547 100644 --- a/src/Form/DataTransformerResolver.php +++ b/src/Form/DataTransformerResolver.php @@ -48,7 +48,7 @@ public function addCustomGlobalTransformer(string $fieldType, DataTransformerInt public function resolve( FieldDescriptionInterface $fieldDescription, - ModelManagerInterface $modelManager + ModelManagerInterface $modelManager, ): ?DataTransformerInterface { $dataTransformer = $fieldDescription->getOption('data_transformer'); diff --git a/src/Form/DataTransformerResolverInterface.php b/src/Form/DataTransformerResolverInterface.php index d9605b4bd6..e5ceeb5d58 100644 --- a/src/Form/DataTransformerResolverInterface.php +++ b/src/Form/DataTransformerResolverInterface.php @@ -36,6 +36,6 @@ public function addCustomGlobalTransformer(string $fieldType, DataTransformerInt */ public function resolve( FieldDescriptionInterface $fieldDescription, - ModelManagerInterface $modelManager + ModelManagerInterface $modelManager, ): ?DataTransformerInterface; } diff --git a/src/Form/Extension/Field/Type/FormTypeFieldExtension.php b/src/Form/Extension/Field/Type/FormTypeFieldExtension.php index 383d9705c0..f597cd4bac 100644 --- a/src/Form/Extension/Field/Type/FormTypeFieldExtension.php +++ b/src/Form/Extension/Field/Type/FormTypeFieldExtension.php @@ -37,7 +37,7 @@ final class FormTypeFieldExtension extends AbstractTypeExtension */ public function __construct( private array $defaultClasses, - private array $options + private array $options, ) { } diff --git a/src/Form/FormMapper.php b/src/Form/FormMapper.php index 988690ba05..46a38d4035 100644 --- a/src/Form/FormMapper.php +++ b/src/Form/FormMapper.php @@ -43,7 +43,7 @@ final class FormMapper extends BaseGroupedMapper implements BlockFormMapper public function __construct( private FormContractorInterface $builder, private FormBuilderInterface $formBuilder, - private AdminInterface $admin + private AdminInterface $admin, ) { } diff --git a/src/Form/Type/ModelType.php b/src/Form/Type/ModelType.php index 6cb6e08817..558222ad82 100644 --- a/src/Form/Type/ModelType.php +++ b/src/Form/Type/ModelType.php @@ -40,7 +40,7 @@ final class ModelType extends AbstractType { public function __construct( - private PropertyAccessorInterface $propertyAccessor + private PropertyAccessorInterface $propertyAccessor, ) { } diff --git a/src/Maker/AdminMaker.php b/src/Maker/AdminMaker.php index c1d4261428..8447b9cfa0 100644 --- a/src/Maker/AdminMaker.php +++ b/src/Maker/AdminMaker.php @@ -88,7 +88,7 @@ final class AdminMaker extends AbstractMaker public function __construct( private string $projectDirectory, private array $availableModelManagers, - private string $defaultController + private string $defaultController, ) { $this->skeletonDirectory = \sprintf('%s/../Resources/skeleton', __DIR__); } @@ -220,7 +220,7 @@ private function generateService( InputInterface $input, ConsoleStyle $io, string $adminClassFullName, - string $controllerClassFullName + string $controllerClassFullName, ): void { $servicesFile = $input->getOption('services'); if (null !== $servicesFile) { @@ -250,7 +250,7 @@ private function generateService( private function generateController( ConsoleStyle $io, Generator $generator, - ClassNameDetails $controllerClassNameDetails + ClassNameDetails $controllerClassNameDetails, ): void { $controllerClassFullName = $controllerClassNameDetails->getFullName(); $generator->generateClass( @@ -273,7 +273,7 @@ private function generateController( private function generateAdmin( ConsoleStyle $io, Generator $generator, - ClassNameDetails $adminClassNameDetails + ClassNameDetails $adminClassNameDetails, ): void { $adminClassFullName = $adminClassNameDetails->getFullName(); diff --git a/src/Manipulator/ObjectManipulator.php b/src/Manipulator/ObjectManipulator.php index a437040e83..667a8c3491 100644 --- a/src/Manipulator/ObjectManipulator.php +++ b/src/Manipulator/ObjectManipulator.php @@ -28,7 +28,7 @@ final class ObjectManipulator public static function addInstance( object $object, object $instance, - FieldDescriptionInterface $parentFieldDescription + FieldDescriptionInterface $parentFieldDescription, ): object { $associationMapping = $parentFieldDescription->getAssociationMapping(); $parentAssociationMappings = $parentFieldDescription->getParentAssociationMappings(); @@ -62,7 +62,7 @@ public static function addInstance( public static function setObject( object $instance, object $object, - FieldDescriptionInterface $parentFieldDescription + FieldDescriptionInterface $parentFieldDescription, ): object { $mappedBy = $parentFieldDescription->getAssociationMapping()['mappedBy'] ?? null; if (!\is_string($mappedBy)) { diff --git a/src/Manipulator/ServicesManipulator.php b/src/Manipulator/ServicesManipulator.php index ea967d78ad..5880658716 100644 --- a/src/Manipulator/ServicesManipulator.php +++ b/src/Manipulator/ServicesManipulator.php @@ -28,7 +28,7 @@ class: %s '; public function __construct( - private string $file + private string $file, ) { } diff --git a/src/Menu/Matcher/Voter/AdminVoter.php b/src/Menu/Matcher/Voter/AdminVoter.php index a326127b41..cb857cf5e7 100644 --- a/src/Menu/Matcher/Voter/AdminVoter.php +++ b/src/Menu/Matcher/Voter/AdminVoter.php @@ -26,7 +26,7 @@ final class AdminVoter implements VoterInterface { public function __construct( - private RequestStack $requestStack + private RequestStack $requestStack, ) { } diff --git a/src/Menu/MenuBuilder.php b/src/Menu/MenuBuilder.php index 219713d6d9..60f6a32632 100644 --- a/src/Menu/MenuBuilder.php +++ b/src/Menu/MenuBuilder.php @@ -32,7 +32,7 @@ public function __construct( private Pool $pool, private FactoryInterface $factory, private MenuProviderInterface $provider, - private EventDispatcherInterface $eventDispatcher + private EventDispatcherInterface $eventDispatcher, ) { } diff --git a/src/Menu/Provider/GroupMenuProvider.php b/src/Menu/Provider/GroupMenuProvider.php index bcbd50ebe3..4e2f4e917f 100644 --- a/src/Menu/Provider/GroupMenuProvider.php +++ b/src/Menu/Provider/GroupMenuProvider.php @@ -33,7 +33,7 @@ final class GroupMenuProvider implements MenuProviderInterface public function __construct( private FactoryInterface $menuFactory, private Pool $pool, - private AuthorizationCheckerInterface $checker + private AuthorizationCheckerInterface $checker, ) { } diff --git a/src/Model/AuditManager.php b/src/Model/AuditManager.php index 873fd39ff1..765b1a3d76 100644 --- a/src/Model/AuditManager.php +++ b/src/Model/AuditManager.php @@ -28,7 +28,7 @@ final class AuditManager implements AuditManagerInterface private array $readers = []; public function __construct( - private ContainerInterface $container + private ContainerInterface $container, ) { } diff --git a/src/Model/Revision.php b/src/Model/Revision.php index b658e1f5b5..27375258b0 100644 --- a/src/Model/Revision.php +++ b/src/Model/Revision.php @@ -18,7 +18,7 @@ final class Revision public function __construct( private int|string $id, private \DateTimeInterface $dateTime, - private ?string $username + private ?string $username, ) { } diff --git a/src/Object/Metadata.php b/src/Object/Metadata.php index f837b22d33..5277fa89c8 100644 --- a/src/Object/Metadata.php +++ b/src/Object/Metadata.php @@ -30,7 +30,7 @@ public function __construct( private ?string $description = null, ?string $image = null, private ?string $domain = null, - private array $options = [] + private array $options = [], ) { $this->image = $image ?? self::DEFAULT_MOSAIC_BACKGROUND; } diff --git a/src/Request/AdminFetcher.php b/src/Request/AdminFetcher.php index 51366a4d26..39a942050d 100644 --- a/src/Request/AdminFetcher.php +++ b/src/Request/AdminFetcher.php @@ -20,7 +20,7 @@ final class AdminFetcher implements AdminFetcherInterface { public function __construct( - private Pool $pool + private Pool $pool, ) { } diff --git a/src/Route/AdminPoolLoader.php b/src/Route/AdminPoolLoader.php index f8ce5e4adb..016d2c6a63 100644 --- a/src/Route/AdminPoolLoader.php +++ b/src/Route/AdminPoolLoader.php @@ -28,7 +28,7 @@ final class AdminPoolLoader extends Loader public const ROUTE_TYPE_NAME = 'sonata_admin'; public function __construct( - private Pool $pool + private Pool $pool, ) { parent::__construct(); } diff --git a/src/Route/DefaultRouteGenerator.php b/src/Route/DefaultRouteGenerator.php index 12beaf749e..d1355bcbae 100644 --- a/src/Route/DefaultRouteGenerator.php +++ b/src/Route/DefaultRouteGenerator.php @@ -34,7 +34,7 @@ final class DefaultRouteGenerator implements RouteGeneratorInterface public function __construct( private RouterInterface $router, - private RoutesCache $cache + private RoutesCache $cache, ) { } @@ -47,7 +47,7 @@ public function generateUrl( AdminInterface $admin, string $name, array $parameters = [], - int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH + int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, ): string { $arrayRoute = $this->generateMenuUrl($admin, $name, $parameters, $referenceType); @@ -62,7 +62,7 @@ public function generateMenuUrl( AdminInterface $admin, string $name, array $parameters = [], - int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH + int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, ): array { // if the admin is a child we automatically append the parent's id if ($admin->isChild() && $admin->hasRequest()) { diff --git a/src/Route/PathInfoBuilder.php b/src/Route/PathInfoBuilder.php index 0fb019c195..25c3cad632 100644 --- a/src/Route/PathInfoBuilder.php +++ b/src/Route/PathInfoBuilder.php @@ -23,7 +23,7 @@ final class PathInfoBuilder implements RouteBuilderInterface { public function __construct( - private AuditManagerInterface $manager + private AuditManagerInterface $manager, ) { } diff --git a/src/Route/RouteCollection.php b/src/Route/RouteCollection.php index d0e48ee355..bf42e2dbef 100644 --- a/src/Route/RouteCollection.php +++ b/src/Route/RouteCollection.php @@ -34,7 +34,7 @@ public function __construct( private string $baseCodeRoute, private string $baseRouteName, private string $baseRoutePattern, - private string $baseControllerName + private string $baseControllerName, ) { } @@ -52,7 +52,7 @@ public function add( string $host = '', array $schemes = [], array $methods = [], - string $condition = '' + string $condition = '', ): self { $pattern = \sprintf('%s/%s', $this->baseRoutePattern, $pattern ?? $name); $code = $this->getCode($name); diff --git a/src/Route/RouteCollectionInterface.php b/src/Route/RouteCollectionInterface.php index 52e05dc8da..831c0b6155 100644 --- a/src/Route/RouteCollectionInterface.php +++ b/src/Route/RouteCollectionInterface.php @@ -38,7 +38,7 @@ public function add( string $host = '', array $schemes = [], array $methods = [], - string $condition = '' + string $condition = '', ): self; public function getCode(string $name): string; diff --git a/src/Route/RoutesCache.php b/src/Route/RoutesCache.php index d21e4d10b4..4a70de904f 100644 --- a/src/Route/RoutesCache.php +++ b/src/Route/RoutesCache.php @@ -24,7 +24,7 @@ final class RoutesCache { public function __construct( private string $cacheFolder, - private bool $debug + private bool $debug, ) { } diff --git a/src/Route/RoutesCacheWarmUp.php b/src/Route/RoutesCacheWarmUp.php index 4d1208fcb8..92872f6e7e 100644 --- a/src/Route/RoutesCacheWarmUp.php +++ b/src/Route/RoutesCacheWarmUp.php @@ -23,7 +23,7 @@ final class RoutesCacheWarmUp implements CacheWarmerInterface { public function __construct( private RoutesCache $cache, - private Pool $pool + private Pool $pool, ) { } diff --git a/src/Security/Handler/AclSecurityHandler.php b/src/Security/Handler/AclSecurityHandler.php index 6d1a644edc..c64b8ce598 100644 --- a/src/Security/Handler/AclSecurityHandler.php +++ b/src/Security/Handler/AclSecurityHandler.php @@ -59,7 +59,7 @@ public function __construct( private AuthorizationCheckerInterface $authorizationChecker, private MutableAclProviderInterface $aclProvider, private string $maskBuilderClass, - $superAdminRoles + $superAdminRoles, ) { // NEXT_MAJOR: Keep only the elseif part and add typehint. if (\is_array($superAdminRoles)) { diff --git a/src/Security/Handler/RoleSecurityHandler.php b/src/Security/Handler/RoleSecurityHandler.php index 47ab0db126..4dfb0511a7 100644 --- a/src/Security/Handler/RoleSecurityHandler.php +++ b/src/Security/Handler/RoleSecurityHandler.php @@ -33,7 +33,7 @@ final class RoleSecurityHandler implements SecurityHandlerInterface */ public function __construct( private AuthorizationCheckerInterface $authorizationChecker, - $superAdminRoles + $superAdminRoles, ) { // NEXT_MAJOR: Keep only the elseif part and add typehint. if (\is_array($superAdminRoles)) { diff --git a/src/Show/ShowMapper.php b/src/Show/ShowMapper.php index 2f2a3a318c..345eec12c7 100644 --- a/src/Show/ShowMapper.php +++ b/src/Show/ShowMapper.php @@ -40,7 +40,7 @@ final class ShowMapper extends BaseGroupedMapper public function __construct( private ShowBuilderInterface $builder, private FieldDescriptionCollection $list, - private AdminInterface $admin + private AdminInterface $admin, ) { } diff --git a/src/SonataConfiguration.php b/src/SonataConfiguration.php index 32fbfa4e5e..5e1350f94d 100644 --- a/src/SonataConfiguration.php +++ b/src/SonataConfiguration.php @@ -52,7 +52,7 @@ final class SonataConfiguration public function __construct( private string $title, private string $logo, - private array $options + private array $options, ) { } diff --git a/src/Translator/Extractor/AdminExtractor.php b/src/Translator/Extractor/AdminExtractor.php index 6b3963f2df..40872928d7 100644 --- a/src/Translator/Extractor/AdminExtractor.php +++ b/src/Translator/Extractor/AdminExtractor.php @@ -51,7 +51,7 @@ final class AdminExtractor implements ExtractorInterface, LabelTranslatorStrateg public function __construct( private Pool $adminPool, - private BreadcrumbsBuilderInterface $breadcrumbsBuilder + private BreadcrumbsBuilderInterface $breadcrumbsBuilder, ) { } diff --git a/src/Twig/BreadcrumbsRuntime.php b/src/Twig/BreadcrumbsRuntime.php index c005e81b38..08b1f4fbe5 100644 --- a/src/Twig/BreadcrumbsRuntime.php +++ b/src/Twig/BreadcrumbsRuntime.php @@ -24,7 +24,7 @@ final class BreadcrumbsRuntime implements RuntimeExtensionInterface * @internal This class should only be used through Twig */ public function __construct( - private BreadcrumbsBuilderInterface $breadcrumbsBuilder + private BreadcrumbsBuilderInterface $breadcrumbsBuilder, ) { } @@ -37,7 +37,7 @@ public function __construct( public function renderBreadcrumbs( Environment $environment, AdminInterface $admin, - string $action + string $action, ): string { return $environment->render('@SonataAdmin/Breadcrumb/breadcrumb.html.twig', [ 'items' => $this->breadcrumbsBuilder->getBreadcrumbs($admin, $action), @@ -53,7 +53,7 @@ public function renderBreadcrumbs( public function renderBreadcrumbsForTitle( Environment $environment, AdminInterface $admin, - string $action + string $action, ): string { return $environment->render('@SonataAdmin/Breadcrumb/breadcrumb_title.html.twig', [ 'items' => $this->breadcrumbsBuilder->getBreadcrumbs($admin, $action), diff --git a/src/Twig/CanonicalizeRuntime.php b/src/Twig/CanonicalizeRuntime.php index 74549fffcc..504e86eb74 100644 --- a/src/Twig/CanonicalizeRuntime.php +++ b/src/Twig/CanonicalizeRuntime.php @@ -27,7 +27,7 @@ final class CanonicalizeRuntime implements RuntimeExtensionInterface */ public function __construct( private RequestStack $requestStack, - private ?SonataFormCanonicalizeRuntime $canonicalizeRuntime = null // @phpstan-ignore-line + private ?SonataFormCanonicalizeRuntime $canonicalizeRuntime = null, // @phpstan-ignore-line ) { } diff --git a/src/Twig/Extension/BreadcrumbsExtension.php b/src/Twig/Extension/BreadcrumbsExtension.php index 8e5df3241a..d04c9a4133 100644 --- a/src/Twig/Extension/BreadcrumbsExtension.php +++ b/src/Twig/Extension/BreadcrumbsExtension.php @@ -27,7 +27,7 @@ final class BreadcrumbsExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private BreadcrumbsRuntime $breadcrumbsRuntime + private BreadcrumbsRuntime $breadcrumbsRuntime, ) { } @@ -61,7 +61,7 @@ public function getFunctions(): array public function renderBreadcrumbs( Environment $environment, AdminInterface $admin, - string $action + string $action, ): string { @trigger_error(\sprintf( 'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.' @@ -87,7 +87,7 @@ public function renderBreadcrumbs( public function renderBreadcrumbsForTitle( Environment $environment, AdminInterface $admin, - string $action + string $action, ): string { @trigger_error(\sprintf( 'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.' diff --git a/src/Twig/Extension/CanonicalizeExtension.php b/src/Twig/Extension/CanonicalizeExtension.php index 834a7a6aef..47395b0ba4 100644 --- a/src/Twig/Extension/CanonicalizeExtension.php +++ b/src/Twig/Extension/CanonicalizeExtension.php @@ -25,7 +25,7 @@ final class CanonicalizeExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private CanonicalizeRuntime $canonicalizeRuntime + private CanonicalizeRuntime $canonicalizeRuntime, ) { } diff --git a/src/Twig/Extension/GroupExtension.php b/src/Twig/Extension/GroupExtension.php index 165bda1645..f76f670d69 100644 --- a/src/Twig/Extension/GroupExtension.php +++ b/src/Twig/Extension/GroupExtension.php @@ -30,7 +30,7 @@ final class GroupExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private GroupRuntime $groupRuntime + private GroupRuntime $groupRuntime, ) { } diff --git a/src/Twig/Extension/IconExtension.php b/src/Twig/Extension/IconExtension.php index ae9f4dfc31..a18f1a8c08 100644 --- a/src/Twig/Extension/IconExtension.php +++ b/src/Twig/Extension/IconExtension.php @@ -25,7 +25,7 @@ final class IconExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private IconRuntime $iconRuntime + private IconRuntime $iconRuntime, ) { } diff --git a/src/Twig/Extension/RenderElementExtension.php b/src/Twig/Extension/RenderElementExtension.php index 44beb9c767..50ccc9107f 100644 --- a/src/Twig/Extension/RenderElementExtension.php +++ b/src/Twig/Extension/RenderElementExtension.php @@ -27,7 +27,7 @@ final class RenderElementExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private RenderElementRuntime $renderElementRuntime + private RenderElementRuntime $renderElementRuntime, ) { } @@ -82,7 +82,7 @@ public function renderListElement( Environment $environment, $listElement, FieldDescriptionInterface $fieldDescription, - array $params = [] + array $params = [], ): string { @trigger_error(\sprintf( 'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.' @@ -103,7 +103,7 @@ public function renderListElement( public function renderViewElement( Environment $environment, FieldDescriptionInterface $fieldDescription, - object $object + object $object, ): string { @trigger_error(\sprintf( 'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.' @@ -127,7 +127,7 @@ public function renderViewElementCompare( Environment $environment, FieldDescriptionInterface $fieldDescription, mixed $baseObject, - mixed $compareObject + mixed $compareObject, ): string { @trigger_error(\sprintf( 'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.' diff --git a/src/Twig/Extension/SecurityExtension.php b/src/Twig/Extension/SecurityExtension.php index 9ec688c658..03c190bdd9 100644 --- a/src/Twig/Extension/SecurityExtension.php +++ b/src/Twig/Extension/SecurityExtension.php @@ -25,7 +25,7 @@ final class SecurityExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private SecurityRuntime $securityRuntime + private SecurityRuntime $securityRuntime, ) { } diff --git a/src/Twig/Extension/SonataAdminExtension.php b/src/Twig/Extension/SonataAdminExtension.php index 8c9be89111..389ef7d5ea 100644 --- a/src/Twig/Extension/SonataAdminExtension.php +++ b/src/Twig/Extension/SonataAdminExtension.php @@ -29,7 +29,7 @@ final class SonataAdminExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private SonataAdminRuntime $sonataAdminRuntime + private SonataAdminRuntime $sonataAdminRuntime, ) { } diff --git a/src/Twig/Extension/TemplateRegistryExtension.php b/src/Twig/Extension/TemplateRegistryExtension.php index 6d71d0217e..3ce063743e 100644 --- a/src/Twig/Extension/TemplateRegistryExtension.php +++ b/src/Twig/Extension/TemplateRegistryExtension.php @@ -27,7 +27,7 @@ final class TemplateRegistryExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private TemplateRegistryRuntime $templateRegistryRuntime + private TemplateRegistryRuntime $templateRegistryRuntime, ) { } diff --git a/src/Twig/Extension/XEditableExtension.php b/src/Twig/Extension/XEditableExtension.php index 8ff273e207..e9092fb1da 100644 --- a/src/Twig/Extension/XEditableExtension.php +++ b/src/Twig/Extension/XEditableExtension.php @@ -41,7 +41,7 @@ final class XEditableExtension extends AbstractExtension * @internal This class should only be used through Twig */ public function __construct( - private XEditableRuntime $xEditableRuntime + private XEditableRuntime $xEditableRuntime, ) { } diff --git a/src/Twig/GroupRuntime.php b/src/Twig/GroupRuntime.php index 9838b02a19..892406a9c2 100644 --- a/src/Twig/GroupRuntime.php +++ b/src/Twig/GroupRuntime.php @@ -26,7 +26,7 @@ final class GroupRuntime implements RuntimeExtensionInterface * @internal This class should only be used through Twig */ public function __construct( - private Pool $pool + private Pool $pool, ) { } diff --git a/src/Twig/RenderElementRuntime.php b/src/Twig/RenderElementRuntime.php index 2ee61d98b7..f40fd25d8c 100644 --- a/src/Twig/RenderElementRuntime.php +++ b/src/Twig/RenderElementRuntime.php @@ -26,7 +26,7 @@ final class RenderElementRuntime implements RuntimeExtensionInterface * @internal This class should only be used through Twig */ public function __construct( - private PropertyAccessorInterface $propertyAccessor + private PropertyAccessorInterface $propertyAccessor, ) { } @@ -40,7 +40,7 @@ public function renderListElement( Environment $environment, $listElement, FieldDescriptionInterface $fieldDescription, - array $params = [] + array $params = [], ): string { $template = $this->getTemplate( $fieldDescription, @@ -61,7 +61,7 @@ public function renderListElement( public function renderViewElement( Environment $environment, FieldDescriptionInterface $fieldDescription, - object $object + object $object, ): string { $template = $this->getTemplate( $fieldDescription, @@ -84,7 +84,7 @@ public function renderViewElementCompare( Environment $environment, FieldDescriptionInterface $fieldDescription, object $baseObject, - object $compareObject + object $compareObject, ): string { $template = $this->getTemplate( $fieldDescription, @@ -174,7 +174,7 @@ public function renderRelationElement(mixed $element, FieldDescriptionInterface */ private function getObjectAndValueFromListElement( $listElement, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): array { if (\is_object($listElement)) { $object = $listElement; @@ -204,7 +204,7 @@ private function render( FieldDescriptionInterface $fieldDescription, TemplateWrapper $template, array $parameters, - Environment $environment + Environment $environment, ): string { $content = $template->render($parameters); @@ -236,7 +236,7 @@ private function render( private function getTemplate( FieldDescriptionInterface $fieldDescription, string $defaultTemplate, - Environment $environment + Environment $environment, ): TemplateWrapper { $templateName = $fieldDescription->getTemplate() ?? $defaultTemplate; diff --git a/src/Twig/SecurityRuntime.php b/src/Twig/SecurityRuntime.php index 366f5931bd..84148b1102 100644 --- a/src/Twig/SecurityRuntime.php +++ b/src/Twig/SecurityRuntime.php @@ -24,7 +24,7 @@ final class SecurityRuntime implements RuntimeExtensionInterface * @internal This class should only be used through Twig */ public function __construct( - private ?AuthorizationCheckerInterface $securityChecker = null + private ?AuthorizationCheckerInterface $securityChecker = null, ) { } diff --git a/src/Twig/SonataAdminRuntime.php b/src/Twig/SonataAdminRuntime.php index 289da4cfc5..a1f29b3db6 100644 --- a/src/Twig/SonataAdminRuntime.php +++ b/src/Twig/SonataAdminRuntime.php @@ -24,7 +24,7 @@ final class SonataAdminRuntime implements RuntimeExtensionInterface * @internal This class should only be used through Twig */ public function __construct( - private Pool $pool + private Pool $pool, ) { } diff --git a/src/Twig/TemplateRegistryRuntime.php b/src/Twig/TemplateRegistryRuntime.php index 0065bbb784..1ad1ebf91b 100644 --- a/src/Twig/TemplateRegistryRuntime.php +++ b/src/Twig/TemplateRegistryRuntime.php @@ -27,7 +27,7 @@ final class TemplateRegistryRuntime implements RuntimeExtensionInterface */ public function __construct( private TemplateRegistryInterface $globalTemplateRegistry, - private Pool $pool + private Pool $pool, ) { } diff --git a/src/Twig/XEditableRuntime.php b/src/Twig/XEditableRuntime.php index 0d8979fc1b..1cf35e7d06 100644 --- a/src/Twig/XEditableRuntime.php +++ b/src/Twig/XEditableRuntime.php @@ -40,7 +40,7 @@ final class XEditableRuntime implements RuntimeExtensionInterface */ public function __construct( private TranslatorInterface $translator, - private array $xEditableTypeMapping = self::FIELD_DESCRIPTION_MAPPING + private array $xEditableTypeMapping = self::FIELD_DESCRIPTION_MAPPING, ) { } diff --git a/src/Util/AdminAclManipulator.php b/src/Util/AdminAclManipulator.php index e0e8bb5c23..5b9ecebbe1 100644 --- a/src/Util/AdminAclManipulator.php +++ b/src/Util/AdminAclManipulator.php @@ -30,7 +30,7 @@ final class AdminAclManipulator implements AdminAclManipulatorInterface * @phpstan-param class-string $maskBuilderClass */ public function __construct( - private string $maskBuilderClass + private string $maskBuilderClass, ) { } @@ -66,7 +66,7 @@ public function addAdminClassAces( OutputInterface $output, MutableAclInterface $acl, AclSecurityHandlerInterface $securityHandler, - AdminInterface $admin + AdminInterface $admin, ): bool { if (\count($securityHandler->getAdminPermissions()) > 0) { $builder = new $this->maskBuilderClass(); diff --git a/src/Util/AdminAclManipulatorInterface.php b/src/Util/AdminAclManipulatorInterface.php index 2406a5a188..55ff7322eb 100644 --- a/src/Util/AdminAclManipulatorInterface.php +++ b/src/Util/AdminAclManipulatorInterface.php @@ -41,6 +41,6 @@ public function addAdminClassAces( OutputInterface $output, MutableAclInterface $acl, AclSecurityHandlerInterface $securityHandler, - AdminInterface $admin + AdminInterface $admin, ): bool; } diff --git a/src/Util/AdminObjectAclData.php b/src/Util/AdminObjectAclData.php index 6df44773cd..1417308e29 100644 --- a/src/Util/AdminObjectAclData.php +++ b/src/Util/AdminObjectAclData.php @@ -59,7 +59,7 @@ public function __construct( private object $object, private \Traversable $aclUsers, private string $maskBuilderClass, - ?\Traversable $aclRoles = null + ?\Traversable $aclRoles = null, ) { $this->aclRoles = $aclRoles ?? new \ArrayIterator(); if (!$admin->isAclEnabled()) { diff --git a/src/Util/AdminObjectAclManipulator.php b/src/Util/AdminObjectAclManipulator.php index 7e760ee051..0249472b94 100644 --- a/src/Util/AdminObjectAclManipulator.php +++ b/src/Util/AdminObjectAclManipulator.php @@ -42,7 +42,7 @@ final class AdminObjectAclManipulator */ public function __construct( private FormFactoryInterface $formFactory, - private string $maskBuilderClass + private string $maskBuilderClass, ) { } diff --git a/src/Util/FormBuilderIterator.php b/src/Util/FormBuilderIterator.php index 2e1bc9b21e..4a85060e32 100644 --- a/src/Util/FormBuilderIterator.php +++ b/src/Util/FormBuilderIterator.php @@ -31,7 +31,7 @@ final class FormBuilderIterator extends \RecursiveArrayIterator public function __construct( private FormBuilderInterface $formBuilder, - ?string $prefix = null + ?string $prefix = null, ) { parent::__construct(); $this->prefix = $prefix ?? $formBuilder->getName(); diff --git a/src/Util/ObjectAclManipulator.php b/src/Util/ObjectAclManipulator.php index 442c9a9e83..7460bec1e5 100644 --- a/src/Util/ObjectAclManipulator.php +++ b/src/Util/ObjectAclManipulator.php @@ -41,7 +41,7 @@ final public function configureAcls( OutputInterface $output, AdminInterface $admin, \Traversable $oids, - ?UserSecurityIdentity $securityIdentity = null + ?UserSecurityIdentity $securityIdentity = null, ): array { $countAdded = 0; $countUpdated = 0; diff --git a/src/Util/ObjectAclManipulatorInterface.php b/src/Util/ObjectAclManipulatorInterface.php index bc7681e3c1..88e8775682 100644 --- a/src/Util/ObjectAclManipulatorInterface.php +++ b/src/Util/ObjectAclManipulatorInterface.php @@ -33,6 +33,6 @@ interface ObjectAclManipulatorInterface public function batchConfigureAcls( OutputInterface $output, AdminInterface $admin, - ?UserSecurityIdentity $securityIdentity = null + ?UserSecurityIdentity $securityIdentity = null, ): void; } diff --git a/tests/Action/AppendFormFieldElementActionTest.php b/tests/Action/AppendFormFieldElementActionTest.php index f43d6e443f..2e982649ed 100644 --- a/tests/Action/AppendFormFieldElementActionTest.php +++ b/tests/Action/AppendFormFieldElementActionTest.php @@ -101,7 +101,7 @@ public function testAppendFormFieldElementAction(): void $response = ($this->action)($request); static::assertInstanceOf(Response::class, $response); - static::assertSame($response->getContent(), 'block'); + static::assertSame('block', $response->getContent()); } /** diff --git a/tests/Action/RetrieveFormFieldElementActionTest.php b/tests/Action/RetrieveFormFieldElementActionTest.php index 76b191ad3c..28f7b07c0c 100644 --- a/tests/Action/RetrieveFormFieldElementActionTest.php +++ b/tests/Action/RetrieveFormFieldElementActionTest.php @@ -103,7 +103,7 @@ public function testRetrieveFormFieldElementAction(): void $response = ($this->action)($request); static::assertInstanceOf(Response::class, $response); - static::assertSame($response->getContent(), 'block'); + static::assertSame('block', $response->getContent()); } /** diff --git a/tests/Action/SetObjectFieldValueActionTest.php b/tests/Action/SetObjectFieldValueActionTest.php index fe2426b538..7d536eaad3 100644 --- a/tests/Action/SetObjectFieldValueActionTest.php +++ b/tests/Action/SetObjectFieldValueActionTest.php @@ -151,7 +151,7 @@ public function provideSetObjectFieldValueActionWithDateCases(): iterable */ public function testSetObjectFieldValueActionWithDate( \DateTimeZone|string|false|null $timezone, - \DateTimeZone $expectedTimezone + \DateTimeZone $expectedTimezone, ): void { $object = new Bafoo(); $request = new Request([ diff --git a/tests/Admin/Extension/LockExtensionTest.php b/tests/Admin/Extension/LockExtensionTest.php index 75ff7a1427..75f5ca8cb5 100644 --- a/tests/Admin/Extension/LockExtensionTest.php +++ b/tests/Admin/Extension/LockExtensionTest.php @@ -231,7 +231,7 @@ private function configureFormMapper(): FormMapper private function configureAdmin( ModelManagerInterface $modelManager, string $uniqId = '', - ?Request $request = null + ?Request $request = null, ): void { $this->admin->method('getUniqId')->willReturn($uniqId); $this->admin->method('getModelManager')->willReturn($modelManager); diff --git a/tests/App/Builder/DatagridBuilder.php b/tests/App/Builder/DatagridBuilder.php index b7c6f7deb6..bfadb4cdde 100644 --- a/tests/App/Builder/DatagridBuilder.php +++ b/tests/App/Builder/DatagridBuilder.php @@ -38,7 +38,7 @@ final class DatagridBuilder implements DatagridBuilderInterface public function __construct( private FormFactoryInterface $formFactory, private PagerInterface $pager, - private ProxyQueryInterface $proxyQuery + private ProxyQueryInterface $proxyQuery, ) { } diff --git a/tests/App/Datagrid/Pager.php b/tests/App/Datagrid/Pager.php index b764006595..6ae260f2f8 100644 --- a/tests/App/Datagrid/Pager.php +++ b/tests/App/Datagrid/Pager.php @@ -23,7 +23,7 @@ final class Pager implements PagerInterface { public function __construct( - private FooRepository $repository + private FooRepository $repository, ) { } diff --git a/tests/App/Model/Bar.php b/tests/App/Model/Bar.php index b5581ec196..0de85de5c0 100644 --- a/tests/App/Model/Bar.php +++ b/tests/App/Model/Bar.php @@ -18,7 +18,7 @@ final class Bar implements EntityInterface public function __construct( private string $id, private ?Foo $foo = null, - private ?Baz $baz = null + private ?Baz $baz = null, ) { } diff --git a/tests/App/Model/BarRepository.php b/tests/App/Model/BarRepository.php index 76b5d3f25f..fc3049d0e2 100644 --- a/tests/App/Model/BarRepository.php +++ b/tests/App/Model/BarRepository.php @@ -25,7 +25,7 @@ final class BarRepository implements RepositoryInterface public function __construct( FooRepository $fooRepository, - BazRepository $bazRepository + BazRepository $bazRepository, ) { $this->elements = [ 'test_id' => new Bar('test_id', $fooRepository->byId('test_id'), $bazRepository->byId('test_id')), diff --git a/tests/App/Model/Baz.php b/tests/App/Model/Baz.php index 3c14a56b76..86fb2191dd 100644 --- a/tests/App/Model/Baz.php +++ b/tests/App/Model/Baz.php @@ -16,7 +16,7 @@ final class Baz implements EntityInterface { public function __construct( - private string $id + private string $id, ) { } diff --git a/tests/App/Model/Foo.php b/tests/App/Model/Foo.php index 31722bacb3..5394820a3b 100644 --- a/tests/App/Model/Foo.php +++ b/tests/App/Model/Foo.php @@ -23,7 +23,7 @@ final class Foo implements EntityInterface public function __construct( private string $id, private string $name, - private array $elements = [] + private array $elements = [], ) { $this->referenced = null; } @@ -38,6 +38,11 @@ public function getName(): string return $this->name; } + public function setReferenced(?Bar $bar): void + { + $this->referenced = $bar; + } + public function getReferenced(): ?Bar { return $this->referenced; diff --git a/tests/App/Model/ModelManager.php b/tests/App/Model/ModelManager.php index 3ed922fee3..4f7a6e3aeb 100644 --- a/tests/App/Model/ModelManager.php +++ b/tests/App/Model/ModelManager.php @@ -28,7 +28,7 @@ final class ModelManager implements ModelManagerInterface, LockInterface * @param RepositoryInterface $repository */ public function __construct( - private RepositoryInterface $repository + private RepositoryInterface $repository, ) { } diff --git a/tests/Controller/CRUDControllerTest.php b/tests/Controller/CRUDControllerTest.php index 63e383e8c2..b6d3191020 100644 --- a/tests/Controller/CRUDControllerTest.php +++ b/tests/Controller/CRUDControllerTest.php @@ -312,7 +312,7 @@ public function testRenderJson1(): void $response = $this->protectedTestedMethods['renderJson']->invoke($this->controller, $data, 200, [], $this->request); static::assertInstanceOf(JsonResponse::class, $response); - static::assertSame($response->headers->get('Content-Type'), 'application/json'); + static::assertSame('application/json', $response->headers->get('Content-Type')); static::assertSame(json_encode($data), $response->getContent()); } @@ -324,7 +324,7 @@ public function testRenderJson2(): void $response = $this->protectedTestedMethods['renderJson']->invoke($this->controller, $data, 200, [], $this->request); static::assertInstanceOf(JsonResponse::class, $response); - static::assertSame($response->headers->get('Content-Type'), 'application/json'); + static::assertSame('application/json', $response->headers->get('Content-Type')); static::assertSame(json_encode($data), $response->getContent()); } @@ -337,7 +337,7 @@ public function testRenderJsonAjax(): void $response = $this->protectedTestedMethods['renderJson']->invoke($this->controller, $data, 200, [], $this->request); static::assertInstanceOf(JsonResponse::class, $response); - static::assertSame($response->headers->get('Content-Type'), 'application/json'); + static::assertSame('application/json', $response->headers->get('Content-Type')); static::assertSame(json_encode($data), $response->getContent()); } @@ -535,7 +535,7 @@ public function testListActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('list')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->controller->listAction($this->request); } @@ -613,7 +613,7 @@ public function testBatchActionDeleteAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('batchDelete')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->controller->batchActionDelete($this->createMock(ProxyQueryInterface::class)); } @@ -787,7 +787,7 @@ public function testShowActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('show')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -912,7 +912,7 @@ public function testRedirectTo( string $route, array $queryParams, array $requestParams, - bool $hasActiveSubclass + bool $hasActiveSubclass, ): void { $this->admin ->method('hasActiveSubclass') @@ -1003,7 +1003,7 @@ public function testDeleteActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('delete')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -1591,7 +1591,7 @@ public function testEditActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('edit')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -2328,7 +2328,7 @@ public function testEditActionWithLockException(): void $this->admin ->method('update') - ->will(static::throwException(new LockException())); + ->willThrowException(new LockException()); $this->admin ->method('toString') @@ -2355,7 +2355,7 @@ public function testCreateActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('create')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -3052,7 +3052,7 @@ public function testExportActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('export')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -3122,7 +3122,7 @@ public function testHistoryActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('history')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); $this->controller->historyAction($this->request); @@ -3273,7 +3273,7 @@ public function testAclActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('acl'), static::equalTo($object)) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -3542,7 +3542,7 @@ public function testHistoryViewRevisionActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('historyViewRevision')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -3723,7 +3723,7 @@ public function testHistoryCompareRevisionsActionAccessDenied(): void $this->admin->expects(static::once()) ->method('checkAccess') ->with(static::equalTo('historyCompareRevisions')) - ->will(static::throwException(new AccessDeniedException())); + ->willThrowException(new AccessDeniedException()); $this->expectException(AccessDeniedException::class); @@ -4654,7 +4654,7 @@ private function expectTranslate( string $id, array $parameters = [], ?string $domain = null, - ?string $locale = null + ?string $locale = null, ): void { $this->translator->expects(static::once()) ->method('trans') diff --git a/tests/Datagrid/DatagridMapperTest.php b/tests/Datagrid/DatagridMapperTest.php index 637e805b46..fb861fbcc9 100644 --- a/tests/Datagrid/DatagridMapperTest.php +++ b/tests/Datagrid/DatagridMapperTest.php @@ -72,7 +72,7 @@ protected function setUp(): void ->willReturnCallback(function ( Datagrid $datagrid, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void { $fieldDescription->setType($type); diff --git a/tests/Datagrid/ListMapperTest.php b/tests/Datagrid/ListMapperTest.php index 7acc6fd85e..d81cd71e14 100644 --- a/tests/Datagrid/ListMapperTest.php +++ b/tests/Datagrid/ListMapperTest.php @@ -56,7 +56,7 @@ protected function setUp(): void ->willReturnCallback(static function ( FieldDescriptionCollection $list, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void { $fieldDescription->setType($type); $list->add($fieldDescription); diff --git a/tests/EventListener/ConfigureCRUDControllerListenerTest.php b/tests/EventListener/ConfigureCRUDControllerListenerTest.php index 1a1bd9df19..19083d7f20 100644 --- a/tests/EventListener/ConfigureCRUDControllerListenerTest.php +++ b/tests/EventListener/ConfigureCRUDControllerListenerTest.php @@ -74,8 +74,8 @@ public function testItConfiguresCRUDController(): void ->method('addGlobal') ->willReturnCallback(static function (string $name) use ($matcher) { match ($matcher->getInvocationCount()) { - 1 => static::assertSame($name, 'admin'), - 2 => static::assertSame($name, 'base_template'), + 1 => static::assertSame('admin', $name), + 2 => static::assertSame('base_template', $name), default => throw new \LogicException('Exactly 2 calls'), }; }); diff --git a/tests/Fixtures/Entity/Entity.php b/tests/Fixtures/Entity/Entity.php index 82412f7377..dbe11e164c 100644 --- a/tests/Fixtures/Entity/Entity.php +++ b/tests/Fixtures/Entity/Entity.php @@ -16,7 +16,7 @@ final class Entity extends AbstractEntity { public function __construct( - private int $id + private int $id, ) { } diff --git a/tests/Fixtures/Mapper/AbstractDummyGroupedMapper.php b/tests/Fixtures/Mapper/AbstractDummyGroupedMapper.php index 36bc47f7f5..88f8263146 100644 --- a/tests/Fixtures/Mapper/AbstractDummyGroupedMapper.php +++ b/tests/Fixtures/Mapper/AbstractDummyGroupedMapper.php @@ -25,7 +25,7 @@ abstract class AbstractDummyGroupedMapper extends BaseGroupedMapper * @param AdminInterface $admin */ public function __construct( - private AdminInterface $admin + private AdminInterface $admin, ) { } diff --git a/tests/Fixtures/TestExtension.php b/tests/Fixtures/TestExtension.php index d856d40951..19b0ce4cdc 100644 --- a/tests/Fixtures/TestExtension.php +++ b/tests/Fixtures/TestExtension.php @@ -32,7 +32,7 @@ final class TestExtension implements FormExtensionInterface private array $extensions = []; public function __construct( - private ?FormTypeGuesserInterface $guesser + private ?FormTypeGuesserInterface $guesser, ) { } diff --git a/tests/Form/FormMapperTest.php b/tests/Form/FormMapperTest.php index 3884b71b16..fe0f45e94a 100644 --- a/tests/Form/FormMapperTest.php +++ b/tests/Form/FormMapperTest.php @@ -552,7 +552,7 @@ public function testAddOptionRole(): void private function getFieldDescriptionMock( string $name, ?string $label = null, - ?string $translationDomain = null + ?string $translationDomain = null, ): BaseFieldDescription { $fieldDescription = $this->getMockForAbstractClass(BaseFieldDescription::class, [$name, []]); diff --git a/tests/Menu/Matcher/Voter/AdminVoterTest.php b/tests/Menu/Matcher/Voter/AdminVoterTest.php index 306e96038f..3a8ec2279c 100644 --- a/tests/Menu/Matcher/Voter/AdminVoterTest.php +++ b/tests/Menu/Matcher/Voter/AdminVoterTest.php @@ -99,7 +99,7 @@ private function getChildAdmin( string $parentCode, string $childCode, bool $list = false, - bool $granted = false + bool $granted = false, ): AdminInterface { $parentAdmin = $this->createMock(AdminInterface::class); $parentAdmin @@ -134,7 +134,7 @@ private function getNestedChildAdmin( string $parentCode, string $childCode, bool $list = false, - bool $granted = false + bool $granted = false, ): AdminInterface { $grandParentAdmin = $this->createMock(AdminInterface::class); $grandParentAdmin diff --git a/tests/Menu/Provider/GroupMenuProviderTest.php b/tests/Menu/Provider/GroupMenuProviderTest.php index 38938be6b1..7a57622709 100644 --- a/tests/Menu/Provider/GroupMenuProviderTest.php +++ b/tests/Menu/Provider/GroupMenuProviderTest.php @@ -56,7 +56,7 @@ protected function setUp(): void $urlGenerator->method('generate')->willReturnCallback(static fn ( string $name, array $parameters = [], - int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH + int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, ): string => match ($referenceType) { UrlGeneratorInterface::ABSOLUTE_URL => \sprintf('http://sonata-project/%s%s', $name, [] !== $parameters ? '?'.http_build_query($parameters) : ''), UrlGeneratorInterface::ABSOLUTE_PATH => \sprintf('/%s%s', $name, [] !== $parameters ? '?'.http_build_query($parameters) : ''), @@ -112,7 +112,7 @@ public function testGetMenuProviderWithCheckerGrantedGroupRoles(array $adminGrou $extras = $item->getExtras(); static::assertArrayHasKey('translation_domain', $extras); - static::assertSame($extras['translation_domain'], 'SonataAdminBundle'); + static::assertSame('SonataAdminBundle', $extras['translation_domain']); } public function unanimousGrantCheckerMock(string $role): bool @@ -131,7 +131,7 @@ public function unanimousGrantCheckerNoBazMock(string $role): bool * @dataProvider getAdminGroupsMultipleRoles */ public function testGetMenuProviderWithCheckerGrantedMultipleGroupRoles( - array $adminGroups + array $adminGroups, ): void { $this->checker ->method('isGranted') @@ -158,7 +158,7 @@ public function testGetMenuProviderWithCheckerGrantedMultipleGroupRoles( * @dataProvider getAdminGroupsMultipleRoles */ public function testGetMenuProviderWithCheckerGrantedGroupAndItemRoles( - array $adminGroups + array $adminGroups, ): void { $this->checker ->method('isGranted') @@ -186,7 +186,7 @@ public function testGetMenuProviderWithCheckerGrantedGroupAndItemRoles( * @dataProvider provideGetMenuProviderWithCheckerGrantedMultipleGroupRolesOnTopCases */ public function testGetMenuProviderWithCheckerGrantedMultipleGroupRolesOnTop( - array $adminGroups + array $adminGroups, ): void { $this->checker ->method('isGranted') diff --git a/tests/Route/DefaultRouteGeneratorTest.php b/tests/Route/DefaultRouteGeneratorTest.php index 8bbdeca3c2..c75cf26885 100644 --- a/tests/Route/DefaultRouteGeneratorTest.php +++ b/tests/Route/DefaultRouteGeneratorTest.php @@ -59,7 +59,7 @@ public function testGenerateUrl( string $expected, string $name, array $parameters, - int $referenceType = RouterInterface::ABSOLUTE_PATH + int $referenceType = RouterInterface::ABSOLUTE_PATH, ): void { $childCollection = new RouteCollection('base.Code.Foo|base.Code.Bar', 'admin_acme_child', '/foo/', 'BundleName:ControllerName'); $childCollection->add('bar'); diff --git a/tests/Security/Handler/AclSecurityHandlerTest.php b/tests/Security/Handler/AclSecurityHandlerTest.php index 044006ccd0..840c77bc4c 100644 --- a/tests/Security/Handler/AclSecurityHandlerTest.php +++ b/tests/Security/Handler/AclSecurityHandlerTest.php @@ -94,7 +94,7 @@ public function testWithAuthenticationCredentialsNotFoundException(): void $authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class); $authorizationChecker ->method('isGranted') - ->will(static::throwException(new AuthenticationCredentialsNotFoundException('FAIL'))); + ->willThrowException(new AuthenticationCredentialsNotFoundException('FAIL')); $aclProvider = $this->createMock(MutableAclProviderInterface::class); @@ -112,7 +112,7 @@ public function testWithNonAuthenticationCredentialsNotFoundException(): void $authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class); $authorizationChecker ->method('isGranted') - ->will(static::throwException(new \RuntimeException('FAIL'))); + ->willThrowException(new \RuntimeException('FAIL')); $aclProvider = $this->createMock(MutableAclProviderInterface::class); diff --git a/tests/Security/Handler/RoleSecurityHandlerTest.php b/tests/Security/Handler/RoleSecurityHandlerTest.php index aa0ba79028..d5ba39e6ea 100644 --- a/tests/Security/Handler/RoleSecurityHandlerTest.php +++ b/tests/Security/Handler/RoleSecurityHandlerTest.php @@ -130,7 +130,7 @@ public function testIsGranted( string|array $superAdminRoles, string $adminCode, string|Expression|array $operation, - ?object $object = null + ?object $object = null, ): void { $handler = $this->getRoleSecurityHandler($superAdminRoles); diff --git a/tests/Show/ShowMapperTest.php b/tests/Show/ShowMapperTest.php index 5e3e6f8b58..d15be6992d 100644 --- a/tests/Show/ShowMapperTest.php +++ b/tests/Show/ShowMapperTest.php @@ -128,7 +128,7 @@ protected function setUp(): void ->willReturnCallback(static function ( FieldDescriptionCollection $list, ?string $type, - FieldDescriptionInterface $fieldDescription + FieldDescriptionInterface $fieldDescription, ): void { $list->add($fieldDescription); }); diff --git a/tests/Twig/Extension/RenderElementExtensionTest.php b/tests/Twig/Extension/RenderElementExtensionTest.php index ec458f6944..d0b92a0755 100644 --- a/tests/Twig/Extension/RenderElementExtensionTest.php +++ b/tests/Twig/Extension/RenderElementExtensionTest.php @@ -353,7 +353,7 @@ public function testRenderViewElementCompare( string $type, mixed $value, array $options, - ?string $objectName + ?string $objectName, ): void { $this->fieldDescription ->method('getValue') diff --git a/tests/Twig/RenderElementRuntimeTest.php b/tests/Twig/RenderElementRuntimeTest.php index dafaa77b73..8b62e56554 100644 --- a/tests/Twig/RenderElementRuntimeTest.php +++ b/tests/Twig/RenderElementRuntimeTest.php @@ -337,7 +337,7 @@ public function testRenderViewElementCompare( string $type, mixed $value, array $options, - ?string $objectName + ?string $objectName, ): void { $this->fieldDescription ->method('getValue') From bed2aafa3a1d502fc974d1a215a74b5f3cb5da3b Mon Sep 17 00:00:00 2001 From: Eric Enold Date: Wed, 13 Nov 2024 14:22:02 +0100 Subject: [PATCH 3/6] Support Symfony's `TranslatableInterface` in enum fields (#8212) --- docs/reference/field_types.rst | 58 +++++++++++++++++-- .../views/CRUD/display_enum.html.twig | 3 + tests/Fixtures/Enum/TranslatableSuit.php | 35 +++++++++++ .../render-element-extension-test.en.yaml | 8 +++ .../Extension/RenderElementExtensionTest.php | 47 +++++++++++++++ 5 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 tests/Fixtures/Enum/TranslatableSuit.php create mode 100644 tests/Fixtures/Resources/translations/render-element-extension-test.en.yaml diff --git a/docs/reference/field_types.rst b/docs/reference/field_types.rst index ad8e6e377e..7e1a137933 100644 --- a/docs/reference/field_types.rst +++ b/docs/reference/field_types.rst @@ -16,7 +16,7 @@ Fieldtype Description ``FieldDescriptionInterface::TYPE_DATETIME`` display a formatted date and time. Accepts the options ``format`` and ``timezone`` ``FieldDescriptionInterface::TYPE_STRING`` display a text ``FieldDescriptionInterface::TYPE_EMAIL`` display a mailto link. Accepts the options ``as_string``, ``subject`` and ``body`` -``FieldDescriptionInterface::TYPE_ENUM`` display the name of a backed enum +``FieldDescriptionInterface::TYPE_ENUM`` display an enum ``FieldDescriptionInterface::TYPE_TEXTAREA`` display a textarea ``FieldDescriptionInterface::TYPE_TRANS`` translate the value with a provided ``value_translation_domain`` and ``format`` (sprintf format) option ``FieldDescriptionInterface::TYPE_FLOAT`` display a number @@ -199,13 +199,61 @@ The ``FieldDescriptionInterface::TYPE_CHOICE`` field type also supports multiple You can use the following options: -====================================== ============================================================== +====================================== ======================================================================== Option Description -====================================== ============================================================== +====================================== ======================================================================== **use_value** Determines if the field must show the value or the case' name. ``false`` by default. -**enum_translation_domain** Translation domain. -====================================== ============================================================== + + *Ignored if the enum implements Symfony's* ``TranslatableInterface`` *.* +**enum_translation_domain** | Translation domain. If set, the enum value or case' name will be send + to the translator. + | ``{{ value|trans({}, translation_domain) }}`` + + *Ignored if the enum implements Symfony's* ``TranslatableInterface`` *.* +====================================== ======================================================================== + +.. note:: + + If the enum implements Symfony's ``TranslatableInterface`` the options above will be ignored and the enum's + ``trans()`` method will be used instead to display the enum. + + This provides full compatibility with symfony's + `EnumType `_ form type: + + :: + + protected function configureListFields(ListMapper $list): void + { + $list + // Sonata Admin will select the `FieldDescriptionInterface::TYPE_ENUM` + // field type automatically. If the enum implements `TranslatableInterface`, + // the `trans()` method will be used to render its value. + ->add('saluation') + ; + } + + protected function configureFormFields(FormMapper $form): void + { + $form + // Symfony's EnumType form field will automatically detect the usage of + // the `TranslatableInterface` and use the enum's `trans()` method to + // render the choice labels. + ->add('salutation', EnumType::class, [ + 'class' => Salutation::class, + ]) + ; + } + + protected function configureShowFields(ShowMapper $show): void + { + $show + // Again, Sonata Admin will select the `FieldDescriptionInterface::TYPE_ENUM` + // field type automatically. If the enum implements `TranslatableInterface`, + // the `trans()` method will be used to render its value. + ->add('salutation') + ; + } ``FieldDescriptionInterface::TYPE_URL`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/Resources/views/CRUD/display_enum.html.twig b/src/Resources/views/CRUD/display_enum.html.twig index 0f1d3cd139..0a409f22d1 100644 --- a/src/Resources/views/CRUD/display_enum.html.twig +++ b/src/Resources/views/CRUD/display_enum.html.twig @@ -12,6 +12,9 @@ file that was distributed with this source code. {%- apply spaceless %} {% if value is null %}   + {% elseif value.trans is defined %} + {# Enum implements TranslatableInterface and therefore has direct control over how it should be displayed. #} + {{ value|trans }} {% else %} {% set value = use_value|default(false) ? value.value : value.name %} diff --git a/tests/Fixtures/Enum/TranslatableSuit.php b/tests/Fixtures/Enum/TranslatableSuit.php new file mode 100644 index 0000000000..3dc0269e0e --- /dev/null +++ b/tests/Fixtures/Enum/TranslatableSuit.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\AdminBundle\Tests\Fixtures\Enum; + +use Symfony\Contracts\Translation\TranslatableInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +enum TranslatableSuit: string implements TranslatableInterface +{ + case Hearts = 'hearts'; + case Diamonds = 'diamonds'; + case Clubs = 'clubs'; + case Spades = 'spades'; + + #[\Override] + public function trans(TranslatorInterface $translator, ?string $locale = null): string + { + return $translator->trans( + id: 'enum.suit.'.$this->value, + domain: 'render-element-extension-test', + locale: $locale, + ); + } +} diff --git a/tests/Fixtures/Resources/translations/render-element-extension-test.en.yaml b/tests/Fixtures/Resources/translations/render-element-extension-test.en.yaml new file mode 100644 index 0000000000..1798b3da12 --- /dev/null +++ b/tests/Fixtures/Resources/translations/render-element-extension-test.en.yaml @@ -0,0 +1,8 @@ +D: '[trans]D[/trans]' +Diamonds: '[trans]Diamonds[/trans]' +enum: + suit: + hearts: '[trans]enum.suit.hearts[/trans]' + diamonds: '[trans]enum.suit.diamonds[/trans]' + clubs: '[trans]enum.suit.clubs[/trans]' + spades: '[trans]enum.suit.spades[/trans]' diff --git a/tests/Twig/Extension/RenderElementExtensionTest.php b/tests/Twig/Extension/RenderElementExtensionTest.php index d0b92a0755..9ccba3ee9b 100644 --- a/tests/Twig/Extension/RenderElementExtensionTest.php +++ b/tests/Twig/Extension/RenderElementExtensionTest.php @@ -22,6 +22,7 @@ use Sonata\AdminBundle\Templating\TemplateRegistryInterface; use Sonata\AdminBundle\Tests\Fixtures\Entity\FooToString; use Sonata\AdminBundle\Tests\Fixtures\Enum\Suit; +use Sonata\AdminBundle\Tests\Fixtures\Enum\TranslatableSuit; use Sonata\AdminBundle\Tests\Fixtures\StubFilesystemLoader; use Sonata\AdminBundle\Twig\Extension\RenderElementExtension; use Sonata\AdminBundle\Twig\Extension\XEditableExtension; @@ -36,6 +37,7 @@ use Symfony\Component\Routing\Loader\XmlFileLoader; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Translation\Loader\XliffFileLoader; +use Symfony\Component\Translation\Loader\YamlFileLoader; use Symfony\Component\Translation\Translator; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; @@ -79,12 +81,19 @@ protected function setUp(): void // translation extension $translator = new Translator('en'); $translator->addLoader('xlf', new XliffFileLoader()); + $translator->addLoader('yaml', new YamlFileLoader()); $translator->addResource( 'xlf', \sprintf('%s/../../../src/Resources/translations/SonataAdminBundle.en.xliff', __DIR__), 'en', 'SonataAdminBundle' ); + $translator->addResource( + 'yaml', + \sprintf('%s/../../Fixtures/Resources/translations/render-element-extension-test.en.yaml', __DIR__), + 'en', + 'render-element-extension-test', + ); $this->translator = $translator; @@ -1551,6 +1560,44 @@ class="x-editable" ], ]; + $elements[] = [ + ' [trans]Diamonds[/trans] ', + FieldDescriptionInterface::TYPE_ENUM, + Suit::Diamonds, + [ + 'use_value' => false, + 'enum_translation_domain' => 'render-element-extension-test', + ], + ]; + + $elements[] = [ + ' [trans]D[/trans] ', + FieldDescriptionInterface::TYPE_ENUM, + Suit::Diamonds, + [ + 'use_value' => true, + 'enum_translation_domain' => 'render-element-extension-test', + ], + ]; + + $elements[] = [ + ' [trans]enum.suit.hearts[/trans] ', + FieldDescriptionInterface::TYPE_ENUM, + TranslatableSuit::Hearts, + [], + ]; + + $elements[] = [ + ' [trans]enum.suit.spades[/trans] ', + FieldDescriptionInterface::TYPE_ENUM, + TranslatableSuit::Spades, + [ + // These values are ignored if the enum implements the TranslatableInterface + 'use_value' => false, + 'enum_translation_domain' => 'doesnt-exist', + ], + ]; + return $elements; } From 2f125ee0d2fd0915f3610640ea53bde4cfbde0aa Mon Sep 17 00:00:00 2001 From: Michael Bischof Date: Thu, 14 Nov 2024 19:57:31 +0100 Subject: [PATCH 4/6] Added support for select2 tags (#8213) --- assets/js/admin.js | 6 ++++++ docs/cookbook/recipe_select2.rst | 23 +++++++++++++++++++++++ src/Resources/public/app.js | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/assets/js/admin.js b/assets/js/admin.js index fc24376ace..82f50fba47 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -88,6 +88,7 @@ const Admin = { const popover = select.data('popover'); let maximumSelectionLength = null; let minimumResultsForSearch = 10; + let allowTags = false; select.removeClass('form-control'); @@ -101,6 +102,10 @@ const Admin = { allowClearEnabled = false; } + if (select.attr('data-sonata-select2-allow-tags') === 'true') { + allowTags = true; + } + if (select.attr('data-sonata-select2-maximumSelectionLength')) { maximumSelectionLength = select.attr('data-sonata-select2-maximumSelectionLength'); } @@ -117,6 +122,7 @@ const Admin = { placeholder: allowClearEnabled ? ' ' : '', // allowClear needs placeholder to work properly allowClear: allowClearEnabled, maximumSelectionLength, + tags: allowTags, }); if (undefined !== popover) { diff --git a/docs/cookbook/recipe_select2.rst b/docs/cookbook/recipe_select2.rst index 88dd015a69..274bff8559 100644 --- a/docs/cookbook/recipe_select2.rst +++ b/docs/cookbook/recipe_select2.rst @@ -71,6 +71,29 @@ to enable ``allowClear`` or ``data-sonata-select2-allow-clear = "false"`` to dis You have to use false as string! ``"false"``! +AllowTags +---------- + +Select2 parameter ``allowTags`` can be set using the data attribute ``data-sonata-select2-allow-tags="true"`` +to enable ``allowTags``:: + + use Sonata\AdminBundle\Form\Type\ModelType; + + protected function configureFormFields(FormMapper $form): void + { + $form + ->add('category', ModelType::class, [ + 'attr' => [ + 'data-sonata-select2-allow-tags' => 'true' + ] + ]) + ; + } + +.. note:: + + You have to use true as string! ``"true"``! + Minimum results for search -------------------------- diff --git a/src/Resources/public/app.js b/src/Resources/public/app.js index ad3df65709..0a5e5fa7e6 100644 --- a/src/Resources/public/app.js +++ b/src/Resources/public/app.js @@ -1 +1 @@ -!function(){var e={163:function(t){function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=function(){return[]},e.resolve=e,e.id=163,t.exports=e},3752:function(t,e,i){var n=i(9755);if(void 0===n)throw new Error("AdminLTE requires jQuery");!function(t){"use strict";function e(e,i){if(this.element=e,this.options=i,this.$overlay=t(i.overlayTemplate),""===i.source)throw new Error("Source url was not defined. Please specify a url in your BoxRefresh source option.");this._setUpListeners(),this.load()}var i="lte.boxrefresh",n={source:"",params:{},trigger:".refresh-btn",content:".box-body",loadInContent:!0,responseType:"",overlayTemplate:'
',onLoadStart:function(){},onLoadDone:function(t){return t}};function s(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(o,a))}if("string"==typeof r){if(void 0===r[s])throw new Error("No method named "+s);r[s]()}}))}e.prototype.load=function(){this._addOverlay(),this.options.onLoadStart.call(t(this)),t.get(this.options.source,this.options.params,function(e){this.options.loadInContent&&t(this.element).find(this.options.content).html(e),this.options.onLoadDone.call(t(this),e),this._removeOverlay()}.bind(this),""!==this.options.responseType&&this.options.responseType)},e.prototype._setUpListeners=function(){t(this.element).on("click",this.options.trigger,function(t){t&&t.preventDefault(),this.load()}.bind(this))},e.prototype._addOverlay=function(){t(this.element).append(this.$overlay)},e.prototype._removeOverlay=function(){t(this.$overlay).remove()};var o=t.fn.boxRefresh;t.fn.boxRefresh=s,t.fn.boxRefresh.Constructor=e,t.fn.boxRefresh.noConflict=function(){return t.fn.boxRefresh=o,this},t(window).on("load",(function(){t('[data-widget="box-refresh"]').each((function(){s.call(t(this))}))}))}(n),function(t){"use strict";function e(t,e){this.element=t,this.options=e,this._setUpListeners()}var i="lte.boxwidget",n={animationSpeed:500,collapseTrigger:'[data-widget="collapse"]',removeTrigger:'[data-widget="remove"]',collapseIcon:"fa-minus",expandIcon:"fa-plus",removeIcon:"fa-times"},s=".box-header",o=".box-body",r=".box-footer",a=".box-tools",l="collapsed-box";function c(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(o,a))}if("string"==typeof s){if(void 0===r[s])throw new Error("No method named "+s);r[s]()}}))}e.prototype.toggle=function(){t(this.element).is(".collapsed-box")?this.expand():this.collapse()},e.prototype.expand=function(){var e=t.Event("expanded.boxwidget"),i=t.Event("expanding.boxwidget"),n=this.options.collapseIcon,c=this.options.expandIcon;t(this.element).removeClass(l),t(this.element).children(s+", "+o+", "+r).children(a).find("."+c).removeClass(c).addClass(n),t(this.element).children(o+", "+r).slideDown(this.options.animationSpeed,function(){t(this.element).trigger(e)}.bind(this)).trigger(i)},e.prototype.collapse=function(){var e=t.Event("collapsed.boxwidget"),i=t.Event("collapsing.boxwidget"),n=this.options.collapseIcon,c=this.options.expandIcon;t(this.element).children(s+", "+o+", "+r).children(a).find("."+n).removeClass(n).addClass(c),t(this.element).children(o+", "+r).slideUp(this.options.animationSpeed,function(){t(this.element).addClass(l),t(this.element).trigger(e)}.bind(this)).trigger(i)},e.prototype.remove=function(){var e=t.Event("removed.boxwidget"),i=t.Event("removing.boxwidget");t(this.element).slideUp(this.options.animationSpeed,function(){t(this.element).trigger(e),t(this.element).remove()}.bind(this)).trigger(i)},e.prototype._setUpListeners=function(){var e=this;t(this.element).on("click",this.options.collapseTrigger,(function(i){return i&&i.preventDefault(),e.toggle(t(this)),!1})),t(this.element).on("click",this.options.removeTrigger,(function(i){return i&&i.preventDefault(),e.remove(t(this)),!1}))};var h=t.fn.boxWidget;t.fn.boxWidget=c,t.fn.boxWidget.Constructor=e,t.fn.boxWidget.noConflict=function(){return t.fn.boxWidget=h,this},t(window).on("load",(function(){t(".box").each((function(){c.call(t(this))}))}))}(n),function(t){"use strict";function e(t,e){this.element=t,this.options=e,this.hasBindedResize=!1,this.init()}var i="lte.controlsidebar",n={controlsidebarSlide:!0},s=".control-sidebar",o='[data-toggle="control-sidebar"]',r=".control-sidebar-open",a="control-sidebar-open",l="control-sidebar-hold-transition";function c(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(o,a))}"string"==typeof s&&r.toggle()}))}e.prototype.init=function(){t(this.element).is(o)||t(this).on("click",this.toggle),this.fix(),t(window).resize(function(){this.fix()}.bind(this))},e.prototype.toggle=function(e){e&&e.preventDefault(),this.fix(),t(s).is(r)||t("body").is(r)?this.collapse():this.expand()},e.prototype.expand=function(){t(s).show(),this.options.controlsidebarSlide?t(s).addClass(a):t("body").addClass(l).addClass(a).delay(50).queue((function(){t("body").removeClass(l),t(this).dequeue()})),t(this.element).trigger(t.Event("expanded.controlsidebar"))},e.prototype.collapse=function(){this.options.controlsidebarSlide?t(s).removeClass(a):t("body").addClass(l).removeClass(a).delay(50).queue((function(){t("body").removeClass(l),t(this).dequeue()})),t(s).fadeOut(),t(this.element).trigger(t.Event("collapsed.controlsidebar"))},e.prototype.fix=function(){t("body").is(".layout-boxed")&&this._fixForBoxed(t(".control-sidebar-bg"))},e.prototype._fixForBoxed=function(e){e.css({position:"absolute",height:t(".wrapper").height()})};var h=t.fn.controlSidebar;t.fn.controlSidebar=c,t.fn.controlSidebar.Constructor=e,t.fn.controlSidebar.noConflict=function(){return t.fn.controlSidebar=h,this},t(document).on("click",o,(function(e){e&&e.preventDefault(),c.call(t(this),"toggle")}))}(n),function(t){"use strict";function e(t){this.element=t}var i="lte.directchat";function n(n){return this.each((function(){var s=t(this),o=s.data(i);o||s.data(i,o=new e(s)),"string"==typeof n&&o.toggle(s)}))}e.prototype.toggle=function(t){t.parents(".direct-chat").first().toggleClass("direct-chat-contacts-open")};var s=t.fn.directChat;t.fn.directChat=n,t.fn.directChat.Constructor=e,t.fn.directChat.noConflict=function(){return t.fn.directChat=s,this},t(document).on("click",'[data-widget="chat-pane-toggle"]',(function(e){e&&e.preventDefault(),n.call(t(this),"toggle")}))}(n),function(t){"use strict";function e(t){this.options=t,this.init()}var i="lte.pushmenu",n={collapseScreenSize:767,expandOnHover:!1,expandTransitionDelay:200},s='[data-toggle="push-menu"]',o=".sidebar-mini",r="sidebar-collapse",a="sidebar-open",l="sidebar-expanded-on-hover",c="expanded.pushMenu",h="collapsed.pushMenu";function u(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(a))}"toggle"===s&&r.toggle()}))}e.prototype.init=function(){(this.options.expandOnHover||t("body").is(o+".fixed"))&&(this.expandOnHover(),t("body").addClass("sidebar-mini-expand-feature")),t(".content-wrapper").click(function(){t(window).width()<=this.options.collapseScreenSize&&t("body").hasClass(a)&&this.close()}.bind(this)),t(".sidebar-form .form-control").click((function(t){t.stopPropagation()}))},e.prototype.toggle=function(){var e=t(window).width(),i=!t("body").hasClass(r);e<=this.options.collapseScreenSize&&(i=t("body").hasClass(a)),i?this.close():this.open()},e.prototype.open=function(){t(window).width()>this.options.collapseScreenSize?t("body").removeClass(r).trigger(t.Event(c)):t("body").addClass(a).trigger(t.Event(c))},e.prototype.close=function(){t(window).width()>this.options.collapseScreenSize?t("body").addClass(r).trigger(t.Event(h)):t("body").removeClass(a+" "+r).trigger(t.Event(h))},e.prototype.expandOnHover=function(){t(".main-sidebar").hover(function(){t("body").is(o+".sidebar-collapse")&&t(window).width()>this.options.collapseScreenSize&&this.expand()}.bind(this),function(){t("body").is(".sidebar-expanded-on-hover")&&this.collapse()}.bind(this))},e.prototype.expand=function(){setTimeout((function(){t("body").removeClass(r).addClass(l)}),this.options.expandTransitionDelay)},e.prototype.collapse=function(){setTimeout((function(){t("body").removeClass(l).addClass(r)}),this.options.expandTransitionDelay)};var d=t.fn.pushMenu;t.fn.pushMenu=u,t.fn.pushMenu.Constructor=e,t.fn.pushMenu.noConflict=function(){return t.fn.pushMenu=d,this},t(document).on("click",s,(function(e){e.preventDefault(),u.call(t(this),"toggle")})),t(window).on("load",(function(){u.call(t(s))}))}(n),function(t){"use strict";function e(t,e){this.element=t,this.options=e,this._setUpListeners()}var i="lte.todolist",n={onCheck:function(t){return t},onUnCheck:function(t){return t}},s={data:'[data-widget="todo-list"]'};function o(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(o,a))}if("string"==typeof r){if(void 0===r[s])throw new Error("No method named "+s);r[s]()}}))}e.prototype.toggle=function(t){t.parents(s.li).first().toggleClass("done"),t.prop("checked")?this.check(t):this.unCheck(t)},e.prototype.check=function(t){this.options.onCheck.call(t)},e.prototype.unCheck=function(t){this.options.onUnCheck.call(t)},e.prototype._setUpListeners=function(){var e=this;t(this.element).on("change ifChanged","input:checkbox",(function(){e.toggle(t(this))}))};var r=t.fn.todoList;t.fn.todoList=o,t.fn.todoList.Constructor=e,t.fn.todoList.noConflict=function(){return t.fn.todoList=r,this},t(window).on("load",(function(){t(s.data).each((function(){o.call(t(this))}))}))}(n),function(t){"use strict";function e(e,i){this.element=e,this.options=i,t(this.element).addClass(l),t(s+r,this.element).addClass(a),this._setUpListeners()}var i="lte.tree",n={animationSpeed:500,accordion:!0,followLink:!1,trigger:".treeview a"},s=".treeview",o=".treeview-menu",r=".active",a="menu-open",l="tree";function c(s){return this.each((function(){var o=t(this);if(!o.data(i)){var r=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,new e(o,r))}}))}e.prototype.toggle=function(t,e){var i=t.next(o),n=t.parent(),r=n.hasClass(a);n.is(s)&&(this.options.followLink&&"#"!==t.attr("href")||e.preventDefault(),r?this.collapse(i,n):this.expand(i,n))},e.prototype.expand=function(e,i){var n=t.Event("expanded.tree");if(this.options.accordion){var s=i.siblings(".menu-open, .active"),r=s.children(o);this.collapse(r,s)}i.addClass(a),e.stop().slideDown(this.options.animationSpeed,function(){t(this.element).trigger(n),i.height("auto")}.bind(this))},e.prototype.collapse=function(e,i){var n=t.Event("collapsed.tree");i.removeClass(a),e.stop().slideUp(this.options.animationSpeed,function(){t(this.element).trigger(n),i.find(s).removeClass(a).find(o).hide()}.bind(this))},e.prototype._setUpListeners=function(){var e=this;t(this.element).on("click",this.options.trigger,(function(i){e.toggle(t(this),i)}))};var h=t.fn.tree;t.fn.tree=c,t.fn.tree.Constructor=e,t.fn.tree.noConflict=function(){return t.fn.tree=h,this},t(window).on("load",(function(){t('[data-widget="tree"]').each((function(){c.call(t(this))}))}))}(n),function(t){"use strict";function e(t){this.options=t,this.bindedResize=!1,this.activate()}var i="lte.layout",n={slimscroll:!0,resetHeight:!0},s=".wrapper",o=".content-wrapper",r=".main-header",a=".sidebar",l=".sidebar-menu",c="fixed";function h(s){return this.each((function(){var o=t(this),r=o.data(i);if(!r){var a=t.extend({},n,o.data(),"object"==typeof s&&s);o.data(i,r=new e(a))}if("string"==typeof s){if(void 0===r[s])throw new Error("No method named "+s);r[s]()}}))}e.prototype.activate=function(){this.fix(),this.fixSidebar(),t("body").removeClass("hold-transition"),this.options.resetHeight&&t("body, html, "+s).css({height:"auto","min-height":"100%"}),this.bindedResize||(t(window).resize(function(){this.fix(),this.fixSidebar(),t(".main-header .logo, "+a).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){this.fix(),this.fixSidebar()}.bind(this))}.bind(this)),this.bindedResize=!0),t(l).on("expanded.tree",function(){this.fix(),this.fixSidebar()}.bind(this)),t(l).on("collapsed.tree",function(){this.fix(),this.fixSidebar()}.bind(this))},e.prototype.fix=function(){t(".layout-boxed > "+s).css("overflow","hidden");var e=t(".main-footer").outerHeight()||0,i=t(r).outerHeight()||0,n=i+e,l=t(window).height(),h=t(a).outerHeight()||0;if(t("body").hasClass(c))t(o).css("min-height",l-e);else{var u;u=h+i<=l?(t(o).css("min-height",l-n),l-n):(t(o).css("min-height",h),h);var d=t(".control-sidebar");void 0!==d&&d.height()>u&&t(o).css("min-height",d.height())}},e.prototype.fixSidebar=function(){t("body").hasClass(c)?this.options.slimscroll&&void 0!==t.fn.slimScroll&&0===t(".main-sidebar").find("slimScrollDiv").length&&t(a).slimScroll({height:t(window).height()-t(r).height()+"px"}):void 0!==t.fn.slimScroll&&t(a).slimScroll({destroy:!0}).height("auto")};var u=t.fn.layout;t.fn.layout=h,t.fn.layout.Constuctor=e,t.fn.layout.noConflict=function(){return t.fn.layout=u,this},t(window).on("load",(function(){h.call(t("body"))}))}(n)},4040:function(t,e,i){var n=i(9755);const s={collectionCounters:[],config:null,translations:null,shared_setup(t){s.read_config(),s.log("[core|shared_setup] Register services on",t),s.set_object_field_value(t),s.add_filters(t),s.setup_select2(t),s.setup_icheck(t),s.setup_checkbox_range_selection(t),s.setup_xeditable(t),s.setup_form_tabs_for_errors(t),s.setup_inline_form_errors(t),s.setup_tree_view(t),s.setup_collection_counter(t),s.setup_sticky_elements(t),s.setup_readmore_elements(t),s.setup_form_submit(t)},read_config(){const t=n("[data-sonata-admin]").data("sonata-admin");this.config=t.config,this.translations=t.translations},get_config(t){return null==this.config&&this.read_config(),this.config[t]},get_translations(t){return null==this.translations&&this.read_config(),this.translations[t]},setup_list_modal(t){s.log("[core|setup_list_modal] configure modal on",t),n("div.modal-dialog",t).css({width:"90%",height:"85%",padding:0}),n("div.modal-content",t).css({"border-radius":"0",height:"100%",padding:0}),n(".modal-body",t).css({width:"auto",height:"90%",padding:15,overflow:"auto"}),n(t).trigger("sonata-admin-setup-list-modal")},setup_select2(t){s.get_config("USE_SELECT2")&&(s.log("[core|setup_select2] configure Select2 on",t),n('select:not([data-sonata-select2="false"])',t).each(((t,e)=>{const i=n(e);let o=!1;const r=i.data("popover");let a=null,l=10;i.removeClass("form-control"),i.find('option[value=""]').length||i.attr("data-placeholder")&&i.attr("data-placeholder").length||"true"===i.attr("data-sonata-select2-allow-clear")?o=!0:"false"===i.attr("data-sonata-select2-allow-clear")&&(o=!1),i.attr("data-sonata-select2-maximumSelectionLength")&&(a=i.attr("data-sonata-select2-maximumSelectionLength")),i.attr("data-sonata-select2-minimumResultsForSearch")&&(l=i.attr("data-sonata-select2-minimumResultsForSearch")),i.select2({width:()=>s.get_select2_width(i),theme:"bootstrap",dropdownAutoWidth:!0,minimumResultsForSearch:l,placeholder:o?" ":"",allowClear:o,maximumSelectionLength:a}),void 0!==r&&i.select2("container").popover(r.options)})))},setup_icheck(t){if(s.get_config("USE_ICHECK")){s.log("[core|setup_icheck] configure iCheck on",t);const e=n('input[type="checkbox"]:not(label.btn > input, [data-sonata-icheck="false"]), input[type="radio"]:not(label.btn > input, [data-sonata-icheck="false"])',t);e.iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue"}),t===window.document&&setTimeout((()=>{e.iCheck("update")}),0)}},setup_checkbox_range_selection(t){let e;s.log("[core|setup_checkbox_range_selection] configure checkbox range selection on",t);const i=s.get_config("USE_ICHECK");n('tbody input[type="checkbox"], tbody .iCheck-helper',t).on("click",(s=>{let o;if(o=i?n(s.target).prev('input[type="checkbox"]'):n(s.target),o.length){const r=o.closest("tr").index();if(s.shiftKey&&e>=0){const s=n(`tbody input[type="checkbox"]:nth(${r})`,t).prop("checked");n('tbody input[type="checkbox"]',t).each(((t,o)=>{if(t>e&&tr&&t',container:"body",placement:"auto",success(t){const e=n(t);s.setup_xeditable(e),n(this).closest("td").replaceWith(e)},error:t=>"application/json"===t.getResponseHeader("Content-Type")?JSON.parse(t.responseText):t.responseText})},log(){if(!s.get_config("DEBUG"))return;for(var t=arguments.length,e=new Array(t),i=0;i{if(t.preventDefault(),t.stopPropagation(),"false"===n(t.target).attr("sonata-filter"))return;s.log("[core|add_filters] handle filter container: ",n(t.target).attr("filter-container"));const i=n(`#${n(t.currentTarget).attr("filter-container")}`);0===n('div[sonata-filter="true"]:visible',i).length&&n(i).slideDown();const o=n(t.currentTarget).attr("filter-target"),r=n(`div[id="${o}"]`,i),a=n("i",`.sonata-toggle-filter[filter-target="${o}"]`);n(r).is(":visible")?(a.filter(":not(.fa-minus-circle)").removeClass("fa-check-square").addClass("fa-square"),r.hide()):(a.filter(":not(.fa-minus-circle)").removeClass("fa-square").addClass("fa-check-square"),r.show()),n('div[sonata-filter="true"]:visible',i).length>0?n(i).slideDown():n(i).slideUp(),e()})),n(".sonata-filter-form",t).on("submit",(t=>{const e=n(t.target);if(e.find('[sonata-filter="true"]:hidden :input').val(""),!t.target.dataset.defaultValues)return;const i=s.convert_query_string_to_object(n.param({filter:JSON.parse(t.target.dataset.defaultValues)}));e.find("[name*=filter]").each(((t,s)=>{const o=s.multiple?[]:"",r=i[s.name]||o,a=n(s).val()||o;if(JSON.stringify(r)===JSON.stringify(a))s.removeAttribute("name");else if(s.multiple&&"[]"===JSON.stringify(a)){const t=s.name.substring(0,s.name.length-2);e.append(``),s.removeAttribute("name")}})),0===e.find("[name*=filter]").length&&e.append('')})),0===n(".advanced-filter :input:visible",t).filter((function(){return n(this).val()})).length&&n(".advanced-filter").hide(),n('[data-toggle="advanced-filter"]',t).on("click",(()=>{n(".advanced-filter").toggle()})),e()},set_object_field_value(t){s.log("[core|set_object_field_value] set value field on",t),this.log(n("a.sonata-ba-edit-inline",t)),n("a.sonata-ba-edit-inline",t).on("click",(t=>{s.stopEvent(t);const e=n(t.target);n.ajax({url:e.attr("href"),type:"POST",success:t=>{const i=e.parent();i.children().remove(),i.html(n(t.replace(//g,"")).html()),i.effect("highlight",{color:"#57A957"},2e3),s.set_object_field_value(i)},error:()=>{e.parent().effect("highlight",{color:"#C43C35"},2e3)}})}))},setup_collection_counter(t){s.log("[core|setup_collection_counter] setup collection counter",t);const e=/_([0-9]+)[^0-9]*$/;n(t).find("[data-prototype]").each(((t,i)=>{const o=n(i);let r=-1;o.children().each(((t,i)=>{const s=e.exec(n('[id^="sonata-ba-field-container"]',i).attr("id"));s&&s[1]&&s[1]>r&&(r=parseInt(s[1],10))})),s.collectionCounters[o.attr("id")]=r}))},setup_collection_buttons(t){n(t).on("click",".sonata-collection-add",(t=>{s.stopEvent(t);const e=n(t.target).closest("[data-prototype]");s.collectionCounters[e.attr("id")]+=1;const i=s.collectionCounters[e.attr("id")];let o=e.attr("data-prototype");const r=e.attr("data-prototype-name")||"__name__",a=new RegExp(`${e.attr("id")}_${r}`,"g");o=o.replace(a,`${e.attr("id")}_${i}`);const l=e.attr("id").split("_"),c=new RegExp(`${l[l.length-1]}\\]\\[${r}`,"g");o=o.replace(c,`${l[l.length-1]}][${i}`),n(o).insertBefore(n(t.target).parent()).trigger("sonata-admin-append-form-element"),n(t.target).trigger("sonata-collection-item-added")})),n(t).on("click",".sonata-collection-delete",(t=>{s.stopEvent(t),n(t.target).trigger("sonata-collection-item-deleted"),n(t.target).closest(".sonata-collection-row").remove(),n(document).trigger("sonata-collection-item-deleted-successful")}))},setup_per_page_switcher(t){s.log("[core|setup_per_page_switcher] setup page switcher",t),n("select.per-page").on("change",(t=>{n("input[type=submit]").hide(),window.top.location.href=t.target.options[t.target.selectedIndex].value}))},setup_form_tabs_for_errors(t){s.log("[core|setup_form_tabs_for_errors] setup form tab's errors",t),n("form",t).each(((t,e)=>{s.show_form_first_tab_with_errors(n(e),".sonata-ba-field-error")})),n(t).on("click",'form [type="submit"]',(t=>{s.show_form_first_tab_with_errors(n(t.target).closest("form"),":invalid")})).on("keypress",'form [type="text"]',(t=>{13===t.which&&s.show_form_first_tab_with_errors(n(t.target),":invalid")}))},show_form_first_tab_with_errors(t,e){s.log("[core|show_form_first_tab_with_errors] show first tab with errors",t);let i;t.find(".nav-tabs a").each(((t,s)=>{const o=n(s).attr("href"),r=n(s),a=r.find(".has-errors");n(o).find(e).length>0?(i||(r.tab("show"),i=r),a.removeClass("hide")):a.addClass("hide")}))},setup_inline_form_errors(t){s.log("[core|setup_inline_form_errors] show first tab with errors",t);const e='.sonata-ba-field-inline-table [id$="_delete"][type="checkbox"]';n(e,t).each(((t,e)=>{s.switch_inline_form_errors(n(e))})),n(t).on("change",e,(t=>{s.switch_inline_form_errors(n(t.target))}))},switch_inline_form_errors(t){s.log("[core|switch_inline_form_errors] switch_inline_form_errors",t);const e=t.closest(".sonata-ba-field-inline-table"),i=e.find(".sonata-ba-field-error-messages");t.is(":checked")?(e.find("[required]").removeAttr("required").attr("data-required","required"),i.hide()):(e.find("[data-required]").attr("required","required"),i.show())},setup_tree_view(t){s.log("[core|setup_tree_view] setup tree view",t),n("ul.js-treeview",t).treeView()},get_select2_width(t){const e=/width:(auto|(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc)))/i;let i=t.attr("style");if(void 0!==i){const t=i.split(";");for(let i=0,n=t.length;i=1)return n[1]}}return i=t.css("width"),i.indexOf("%")>0?i:"100%"},setup_sortable_select2(t,e,i){const o=[],r=[],a=[],l=t.val()?t.val().split(","):[];for(let t=0;ts.get_select2_width(t),dropdownAutoWidth:!0,data:[...r,...a],multiple:!0,...i};t.select2(c);const h=t.data("select2").$container.find("ul.select2-selection__rendered");h.sortable({containment:"parent",items:"> li[data-select2-id]",update:()=>{const e=h.children("li[data-select2-id]").toArray().map((t=>o[t.title]));t.val(e.join())}}),t.parents("form:first").submit((()=>{let e=t.val().trim();if(""!==e){let i=t.attr("name");e=e.split(","),i=i.substring(0,i.length-1);for(let s=0;s").attr("type","hidden").attr("name","".concat(i+s,"]")).val(e[s]).appendTo(t.parents("form:first"))}t.remove()}))},setup_sticky_elements(t){if(s.get_config("USE_STICKYFORMS")){s.log("[core|setup_sticky_elements] setup sticky elements on",t);const e=n(t).find(".navbar-static-top"),i=n(t).find(".content-wrapper"),o=n(i).find("nav.navbar"),r=n(i).find(".sonata-ba-form-actions");o.length&&new window.Waypoint.Sticky({element:o[0],offset:()=>(s.refreshNavbarStuckClass(e),n(e).outerHeight()),handler:t=>{"up"===t?n(o).width("auto"):n(o).width(n(i).outerWidth()),s.refreshNavbarStuckClass(e)}}),r.length&&new window.Waypoint({element:i[0],offset:"bottom-in-view",handler:t=>{n(".sonata-ba-form form > .row").outerHeight()+n(r).outerHeight()-2{t.length&&Math.round(n(window).scrollTop()+n(window).height())>=n(document).height()&&n(t).removeClass("stuck"),e.length&&0===n(window).scrollTop()&&n(e).removeClass("stuck")}),250)),n("body").on("expanded.pushMenu collapsed.pushMenu",(()=>{setTimeout((()=>{s.handleResize(t,e,i)}),350)})),n(window).on("resize",s.debounce((()=>{s.handleResize(t,e,i)}),250))},handleResize(t,e,i){e.length&&n(e).hasClass("stuck")&&n(e).width(n(i).outerWidth()),t.length&&n(t).hasClass("stuck")&&n(t).width(n(i).outerWidth())},refreshNavbarStuckClass(t){const e=t.outerHeight();let i=document.getElementById("navbar-stuck");null===i&&(i=document.createElement("style"),i.id="navbar-stuck",i.type="text/css",i.dataset.lastOffset=e,i.innerHTML=`body.fixed .content-header .navbar.stuck { top: ${e}px; }`,document.head.appendChild(i)),i.dataset.lastOffset!==e&&(i.dataset.lastOffset=e,i.innerHTML=`body.fixed .content-header .navbar.stuck { top: ${e}px; }`)},debounce(t,e,i){let n;return function(){for(var s=arguments.length,o=new Array(s),r=0;r{n=null,i||t.apply(a,o)}),e),l&&t.apply(a,o)}},setup_readmore_elements(t){s.log("[core|setup_readmore_elements] setup readmore elements on",t),n(t).find(".sonata-readmore").each(((t,e)=>{const i=n(e);i.readmore({collapsedHeight:parseInt(i.data("readmore-height"),10),moreLink:`${i.data("readmore-more")}`,lessLink:`${i.data("readmore-less")}`})}))},handle_top_navbar_height(){n("body.fixed .content-wrapper").css("padding-top",n(".navbar-static-top").outerHeight())},setup_form_submit(t){s.log("[core|setup_form_submit] setup form submit on",t),n(t).find("form").on("submit",(t=>{const e=n(t.target);setTimeout((()=>{e.find("button").prop("disabled",!0)}),1);const i=e.find(".nav-tabs li.active .changer-tab");i.length>0&&e.find('input[name="_tab"]').val(i.attr("aria-controls"))}))},convert_query_string_to_object(t){return t.split("&").reduce(((t,e)=>{const i=decodeURIComponent(e.split("=")[0]),n=e.split("=")[1];return i.endsWith("[]")?(Object.prototype.hasOwnProperty.call(t,i)||(t[i]=[]),t[i].push(n)):t[i]=n,t}),{})},setup_view_tabs_changer(){n(".changer-tab").on("click",(t=>{const e=n(t.target).attr("aria-controls"),i=window.location.search.substring(1),s=decodeURIComponent(i).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"');let o="{}";s.length&&(o=`{"${s}"}`);const r=JSON.parse(o);r._tab=e;const a=`${window.location.origin+window.location.pathname}?${n.param(r,!0)}`;window.history.pushState({path:a},"",a)}))}};window.Admin=s,n((()=>{s.handle_top_navbar_height(),n("html").removeClass("no-js"),s.setup_per_page_switcher(document),s.setup_collection_buttons(document),s.setup_view_tabs_changer(),s.shared_setup(document)})),n(window).on("resize",(()=>{s.handle_top_navbar_height()})),n(document).on("sonata-admin-append-form-element",(t=>{s.setup_select2(t.target),s.setup_icheck(t.target),s.setup_collection_counter(t.target)})),n(window).on("load",(()=>{s.get_config("CONFIRM_EXIT")&&n(".sonata-ba-form form").each(((t,e)=>{n(e).confirmExit()}))}))},2056:function(t,e,i){var n=i(9755);const s={remove_iCheck_in_flashmessage(){n(".read-more-state").iCheck("destroy")},addFlashmessageListener(){document.querySelectorAll(".read-more-state").forEach((t=>{t.addEventListener("change",(e=>{const i=document.querySelector(`label[for="${t.id}"]`),n=i.querySelector(".more"),s=i.querySelector(".less");e.target.checked?(n.classList.add("hide"),s.classList.remove("hide")):(n.classList.remove("hide"),s.classList.add("hide"))}))}))}};n((()=>{s.remove_iCheck_in_flashmessage(),s.addFlashmessageListener()}))},243:function(t,e,i){var n=i(9755);n.fn.confirmExit=function(){return n(this).attr("data-original",n(this).serialize()),n(this).on("submit",(function(){n(this).removeAttr("data-original")})),n(this)},n(window).on("beforeunload",(t=>{const e=t||window.event,i=window.Admin.get_translations("CONFIRM_EXIT");let s=!1;if(n("form[data-original]").each(((t,e)=>{n(e).attr("data-original")!==n(e).serialize()&&(s=!0)})),s)return e&&(e.returnValue=i),i}))},9543:function(t,e,i){var n=i(9755);n((()=>{n(".sidebar-toggle").on("click",(()=>{document.cookie.includes("sonata_sidebar_hide=1")?document.cookie="sonata_sidebar_hide=0;path=/":document.cookie="sonata_sidebar_hide=1;path=/"}))}))},2916:function(t,e,i){var n=i(9755);const s="treeView",o={togglersAttribute:"[data-treeview-toggler]",toggledState:"is-toggled",activeState:"is-active",defaultToggled:"[data-treeview-toggled]",instanceAttribute:"data-treeview-instance"};function r(t,e){this.element=t,this.options=n.extend({},o,e),this.defaults=o,this.name=s,this.init()}r.prototype={init(){this.setElements(),this.setEvents(),this.setAttributes(),this.showActiveElement(),this.showToggledElements()},setElements(){this.$element=n(this.element),this.$togglers=this.$element.find(this.options.togglersAttribute),this.$defaultToggled=this.$element.find(this.options.defaultToggled)},setAttributes(){this.$element.attr(this.options.instanceAttribute,!0)},setEvents(){this.$togglers.on("click",this.toggle.bind(this))},toggle(t){const e=n(t.currentTarget).parent();e.toggleClass(this.options.toggledState),e.next("ul").slideToggle()},showActiveElement(){const t=`[${this.options.instanceAttribute}] ul, [${this.options.instanceAttribute}]`,e=this.$element.find(`.${this.options.activeState}`).parents(t);e.show(),e.prev().addClass(this.options.toggledState)},showToggledElements(){this.$defaultToggled.addClass(this.options.toggledState),this.$defaultToggled.next("ul").show()}},n.fn[s]=function(t){return this.each((function(){n.data(this,`plugin_${s}`)||n.data(this,`plugin_${s}`,new r(this,t))}))}},7915:function(t,e,i){i(8294),i(1309),i(3929),i(4050),i(63),i(9737),i(8852),i(6278),i(6927),i(3497),i(7814),i(5377)},5377:function(t,e,i){!function(t){"use strict";var e=function(i,n){this.options=t.extend({},e.DEFAULTS,n);var s=this.options.target===e.DEFAULTS.target?t(this.options.target):t(document).find(this.options.target);this.$target=s.on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(i),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(i){return this.each((function(){var n=t(this),s=n.data("bs.affix"),o="object"==typeof i&&i;s||n.data("bs.affix",s=new e(this,o)),"string"==typeof i&&s[i]()}))}e.VERSION="3.4.1",e.RESET="affix affix-top affix-bottom",e.DEFAULTS={offset:0,target:window},e.prototype.getState=function(t,e,i,n){var s=this.$target.scrollTop(),o=this.$element.offset(),r=this.$target.height();if(null!=i&&"top"==this.affixed)return s=t-n&&"bottom"},e.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(e.RESET).addClass("affix");var t=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-t},e.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var i=this.$element.height(),n=this.options.offset,s=n.top,o=n.bottom,r=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(o=s=n),"function"==typeof s&&(s=n.top(this.$element)),"function"==typeof o&&(o=n.bottom(this.$element));var a=this.getState(r,i,s,o);if(this.affixed!=a){null!=this.unpin&&this.$element.css("top","");var l="affix"+(a?"-"+a:""),c=t.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=a,this.unpin="bottom"==a?this.getPinnedOffset():null,this.$element.removeClass(e.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==a&&this.$element.offset({top:r-i-o})}};var n=t.fn.affix;t.fn.affix=i,t.fn.affix.Constructor=e,t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",(function(){t('[data-spy="affix"]').each((function(){var e=t(this),n=e.data();n.offset=n.offset||{},null!=n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!=n.offsetTop&&(n.offset.top=n.offsetTop),i.call(e,n)}))}))}(i(9755))},1309:function(t,e,i){!function(t){"use strict";var e='[data-dismiss="alert"]',i=function(i){t(i).on("click",e,this.close)};i.VERSION="3.4.1",i.TRANSITION_DURATION=150,i.prototype.close=function(e){var n=t(this),s=n.attr("data-target");s||(s=(s=n.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,"")),s="#"===s?[]:s;var o=t(document).find(s);function r(){o.detach().trigger("closed.bs.alert").remove()}e&&e.preventDefault(),o.length||(o=n.closest(".alert")),o.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",r).emulateTransitionEnd(i.TRANSITION_DURATION):r())};var n=t.fn.alert;t.fn.alert=function(e){return this.each((function(){var n=t(this),s=n.data("bs.alert");s||n.data("bs.alert",s=new i(this)),"string"==typeof e&&s[e].call(n)}))},t.fn.alert.Constructor=i,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.bs.alert.data-api",e,i.prototype.close)}(i(9755))},3929:function(t,e,i){!function(t){"use strict";var e=function(i,n){this.$element=t(i),this.options=t.extend({},e.DEFAULTS,n),this.isLoading=!1};function i(i){return this.each((function(){var n=t(this),s=n.data("bs.button"),o="object"==typeof i&&i;s||n.data("bs.button",s=new e(this,o)),"toggle"==i?s.toggle():i&&s.setState(i)}))}e.VERSION="3.4.1",e.DEFAULTS={loadingText:"loading..."},e.prototype.setState=function(e){var i="disabled",n=this.$element,s=n.is("input")?"val":"html",o=n.data();e+="Text",null==o.resetText&&n.data("resetText",n[s]()),setTimeout(t.proxy((function(){n[s](null==o[e]?this.options[e]:o[e]),"loadingText"==e?(this.isLoading=!0,n.addClass(i).attr(i,i).prop(i,!0)):this.isLoading&&(this.isLoading=!1,n.removeClass(i).removeAttr(i).prop(i,!1))}),this),0)},e.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var n=t.fn.button;t.fn.button=i,t.fn.button.Constructor=e,t.fn.button.noConflict=function(){return t.fn.button=n,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',(function(e){var n=t(e.target).closest(".btn");i.call(n,"toggle"),t(e.target).is('input[type="radio"], input[type="checkbox"]')||(e.preventDefault(),n.is("input,button")?n.trigger("focus"):n.find("input:visible,button:visible").first().trigger("focus"))})).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',(function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))}))}(i(9755))},4050:function(t,e,i){!function(t){"use strict";var e=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",t.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};function i(i){return this.each((function(){var n=t(this),s=n.data("bs.carousel"),o=t.extend({},e.DEFAULTS,n.data(),"object"==typeof i&&i),r="string"==typeof i?i:o.slide;s||n.data("bs.carousel",s=new e(this,o)),"number"==typeof i?s.to(i):r?s[r]():o.interval&&s.pause().cycle()}))}e.VERSION="3.4.1",e.TRANSITION_DURATION=600,e.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},e.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},e.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},e.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},e.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var n=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(n)},e.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",(function(){e.to(t)})):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",this.$items.eq(t))},e.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},e.prototype.next=function(){if(!this.sliding)return this.slide("next")},e.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},e.prototype.slide=function(i,n){var s=this.$element.find(".item.active"),o=n||this.getItemForDirection(i,s),r=this.interval,a="next"==i?"left":"right",l=this;if(o.hasClass("active"))return this.sliding=!1;var c=o[0],h=t.Event("slide.bs.carousel",{relatedTarget:c,direction:a});if(this.$element.trigger(h),!h.isDefaultPrevented()){if(this.sliding=!0,r&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var u=t(this.$indicators.children()[this.getItemIndex(o)]);u&&u.addClass("active")}var d=t.Event("slid.bs.carousel",{relatedTarget:c,direction:a});return t.support.transition&&this.$element.hasClass("slide")?(o.addClass(i),"object"==typeof o&&o.length&&o[0].offsetWidth,s.addClass(a),o.addClass(a),s.one("bsTransitionEnd",(function(){o.removeClass([i,a].join(" ")).addClass("active"),s.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout((function(){l.$element.trigger(d)}),0)})).emulateTransitionEnd(e.TRANSITION_DURATION)):(s.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),r&&this.cycle(),this}};var n=t.fn.carousel;t.fn.carousel=i,t.fn.carousel.Constructor=e,t.fn.carousel.noConflict=function(){return t.fn.carousel=n,this};var s=function(e){var n=t(this),s=n.attr("href");s&&(s=s.replace(/.*(?=#[^\s]+$)/,""));var o=n.attr("data-target")||s,r=t(document).find(o);if(r.hasClass("carousel")){var a=t.extend({},r.data(),n.data()),l=n.attr("data-slide-to");l&&(a.interval=!1),i.call(r,a),l&&r.data("bs.carousel").to(l),e.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",s).on("click.bs.carousel.data-api","[data-slide-to]",s),t(window).on("load",(function(){t('[data-ride="carousel"]').each((function(){var e=t(this);i.call(e,e.data())}))}))}(i(9755))},63:function(t,e,i){!function(t){"use strict";var e=function(i,n){this.$element=t(i),this.options=t.extend({},e.DEFAULTS,n),this.$trigger=t('[data-toggle="collapse"][href="#'+i.id+'"],[data-toggle="collapse"][data-target="#'+i.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function i(e){var i,n=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(document).find(n)}function n(i){return this.each((function(){var n=t(this),s=n.data("bs.collapse"),o=t.extend({},e.DEFAULTS,n.data(),"object"==typeof i&&i);!s&&o.toggle&&/show|hide/.test(i)&&(o.toggle=!1),s||n.data("bs.collapse",s=new e(this,o)),"string"==typeof i&&s[i]()}))}e.VERSION="3.4.1",e.TRANSITION_DURATION=350,e.DEFAULTS={toggle:!0},e.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},e.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var i,s=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(s&&s.length&&(i=s.data("bs.collapse"))&&i.transitioning)){var o=t.Event("show.bs.collapse");if(this.$element.trigger(o),!o.isDefaultPrevented()){s&&s.length&&(n.call(s,"hide"),i||s.data("bs.collapse",null));var r=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[r](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var a=function(){this.$element.removeClass("collapsing").addClass("collapse in")[r](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return a.call(this);var l=t.camelCase(["scroll",r].join("-"));this.$element.one("bsTransitionEnd",t.proxy(a,this)).emulateTransitionEnd(e.TRANSITION_DURATION)[r](this.$element[0][l])}}}},e.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var i=t.Event("hide.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var s=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!t.support.transition)return s.call(this);this.$element[n](0).one("bsTransitionEnd",t.proxy(s,this)).emulateTransitionEnd(e.TRANSITION_DURATION)}}},e.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},e.prototype.getParent=function(){return t(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy((function(e,n){var s=t(n);this.addAriaAndCollapsedClass(i(s),s)}),this)).end()},e.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var s=t.fn.collapse;t.fn.collapse=n,t.fn.collapse.Constructor=e,t.fn.collapse.noConflict=function(){return t.fn.collapse=s,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',(function(e){var s=t(this);s.attr("data-target")||e.preventDefault();var o=i(s),r=o.data("bs.collapse")?"toggle":s.data();n.call(o,r)}))}(i(9755))},9737:function(t,e,i){!function(t){"use strict";var e='[data-toggle="dropdown"]',i=function(e){t(e).on("click.bs.dropdown",this.toggle)};function n(e){var i=e.attr("data-target");i||(i=(i=e.attr("href"))&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var n="#"!==i?t(document).find(i):null;return n&&n.length?n:e.parent()}function s(i){i&&3===i.which||(t(".dropdown-backdrop").remove(),t(e).each((function(){var e=t(this),s=n(e),o={relatedTarget:this};s.hasClass("open")&&(i&&"click"==i.type&&/input|textarea/i.test(i.target.tagName)&&t.contains(s[0],i.target)||(s.trigger(i=t.Event("hide.bs.dropdown",o)),i.isDefaultPrevented()||(e.attr("aria-expanded","false"),s.removeClass("open").trigger(t.Event("hidden.bs.dropdown",o)))))})))}i.VERSION="3.4.1",i.prototype.toggle=function(e){var i=t(this);if(!i.is(".disabled, :disabled")){var o=n(i),r=o.hasClass("open");if(s(),!r){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",s);var a={relatedTarget:this};if(o.trigger(e=t.Event("show.bs.dropdown",a)),e.isDefaultPrevented())return;i.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger(t.Event("shown.bs.dropdown",a))}return!1}},i.prototype.keydown=function(i){if(/(38|40|27|32)/.test(i.which)&&!/input|textarea/i.test(i.target.tagName)){var s=t(this);if(i.preventDefault(),i.stopPropagation(),!s.is(".disabled, :disabled")){var o=n(s),r=o.hasClass("open");if(!r&&27!=i.which||r&&27==i.which)return 27==i.which&&o.find(e).trigger("focus"),s.trigger("click");var a=o.find(".dropdown-menu li:not(.disabled):visible a");if(a.length){var l=a.index(i.target);38==i.which&&l>0&&l--,40==i.which&&ldocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},e.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},e.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth

'}),e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),e.prototype.constructor=e,e.prototype.getDefaults=function(){return e.DEFAULTS},e.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var n=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===n&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===n?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},e.prototype.hasContent=function(){return this.getTitle()||this.getContent()},e.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},e.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var i=t.fn.popover;t.fn.popover=function(i){return this.each((function(){var n=t(this),s=n.data("bs.popover"),o="object"==typeof i&&i;!s&&/destroy|hide/.test(i)||(s||n.data("bs.popover",s=new e(this,o)),"string"==typeof i&&s[i]())}))},t.fn.popover.Constructor=e,t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(i(9755))},3497:function(t,e,i){!function(t){"use strict";function e(i,n){this.$body=t(document.body),this.$scrollElement=t(i).is(document.body)?t(window):t(i),this.options=t.extend({},e.DEFAULTS,n),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function i(i){return this.each((function(){var n=t(this),s=n.data("bs.scrollspy"),o="object"==typeof i&&i;s||n.data("bs.scrollspy",s=new e(this,o)),"string"==typeof i&&s[i]()}))}e.VERSION="3.4.1",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,i="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(i="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map((function(){var e=t(this),s=e.data("target")||e.attr("href"),o=/^#./.test(s)&&t(s);return o&&o.length&&o.is(":visible")&&[[o[i]().top+n,s]]||null})).sort((function(t,e){return t[0]-e[0]})).each((function(){e.offsets.push(this[0]),e.targets.push(this[1])}))},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),n=this.options.offset+i-this.$scrollElement.height(),s=this.offsets,o=this.targets,r=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),e>=n)return r!=(t=o[o.length-1])&&this.activate(t);if(r&&e=s[t]&&(void 0===s[t+1]||e .active"),r=s&&t.support.transition&&(o.length&&o.hasClass("fade")||!!n.find("> .fade").length);function a(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),i.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),r?(i[0].offsetWidth,i.addClass("in")):i.removeClass("fade"),i.parent(".dropdown-menu").length&&i.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),s&&s()}o.length&&r?o.one("bsTransitionEnd",a).emulateTransitionEnd(e.TRANSITION_DURATION):a(),o.removeClass("in")};var n=t.fn.tab;t.fn.tab=i,t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=n,this};var s=function(e){e.preventDefault(),i.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',s).on("click.bs.tab.data-api",'[data-toggle="pill"]',s)}(i(9755))},6278:function(t,e,i){!function(t){"use strict";var e=["sanitize","whiteList","sanitizeFn"],i=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],n={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},s=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function r(e,n){var r=e.nodeName.toLowerCase();if(-1!==t.inArray(r,n))return-1===t.inArray(r,i)||Boolean(e.nodeValue.match(s)||e.nodeValue.match(o));for(var a=t(n).filter((function(t,e){return e instanceof RegExp})),l=0,c=a.length;l
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:n},l.prototype.init=function(e,i,n){if(this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.$viewport=this.options.viewport&&t(document).find(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var s=this.options.trigger.split(" "),o=s.length;o--;){var r=s[o];if("click"==r)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=r){var a="hover"==r?"mouseenter":"focusin",l="hover"==r?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},l.prototype.getDefaults=function(){return l.DEFAULTS},l.prototype.getOptions=function(i){var n=this.$element.data();for(var s in n)n.hasOwnProperty(s)&&-1!==t.inArray(s,e)&&delete n[s];return(i=t.extend({},this.getDefaults(),n,i)).delay&&"number"==typeof i.delay&&(i.delay={show:i.delay,hide:i.delay}),i.sanitize&&(i.template=a(i.template,i.whiteList,i.sanitizeFn)),i},l.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,(function(t,n){i[t]!=n&&(e[t]=n)})),e},l.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusin"==e.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState)i.hoverState="in";else{if(clearTimeout(i.timeout),i.hoverState="in",!i.options.delay||!i.options.delay.show)return i.show();i.timeout=setTimeout((function(){"in"==i.hoverState&&i.show()}),i.options.delay.show)}},l.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},l.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusout"==e.type?"focus":"hover"]=!1),!i.isInStateTrue()){if(clearTimeout(i.timeout),i.hoverState="out",!i.options.delay||!i.options.delay.hide)return i.hide();i.timeout=setTimeout((function(){"out"==i.hoverState&&i.hide()}),i.options.delay.hide)}},l.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var i=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!i)return;var n=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var r="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,c=a.test(r);c&&(r=r.replace(a,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(r).data("bs."+this.type,this),this.options.container?s.appendTo(t(document).find(this.options.container)):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var h=this.getPosition(),u=s[0].offsetWidth,d=s[0].offsetHeight;if(c){var p=r,f=this.getPosition(this.$viewport);r="bottom"==r&&h.bottom+d>f.bottom?"top":"top"==r&&h.top-df.width?"left":"left"==r&&h.left-ur.top+r.height&&(s.top=r.top+r.height-l)}else{var c=e.left-o,h=e.left+o+i;cr.right&&(s.left=r.left+r.width-h)}return s},l.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},l.prototype.getUID=function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},l.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},l.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},l.prototype.enable=function(){this.enabled=!0},l.prototype.disable=function(){this.enabled=!1},l.prototype.toggleEnabled=function(){this.enabled=!this.enabled},l.prototype.toggle=function(e){var i=this;e&&((i=t(e.currentTarget).data("bs."+this.type))||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i))),e?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)},l.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide((function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null}))},l.prototype.sanitizeHtml=function(t){return a(t,this.options.whiteList,this.options.sanitizeFn)};var c=t.fn.tooltip;t.fn.tooltip=function(e){return this.each((function(){var i=t(this),n=i.data("bs.tooltip"),s="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||i.data("bs.tooltip",n=new l(this,s)),"string"==typeof e&&n[e]())}))},t.fn.tooltip.Constructor=l,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=c,this}}(i(9755))},8294:function(t,e,i){!function(t){"use strict";t.fn.emulateTransitionEnd=function(e){var i=!1,n=this;t(this).one("bsTransitionEnd",(function(){i=!0}));return setTimeout((function(){i||t(n).trigger(t.support.transition.end)}),e),this},t((function(){t.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})}))}(i(9755))},9741:function(t,e,i){var n,s;!function(o,r){"use strict";void 0===(s="function"==typeof(n=r)?n.call(e,i,e,t):n)||(t.exports=s)}(window,(function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i