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')