Skip to content

Commit

Permalink
Fix build (#8215)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Nov 13, 2024
1 parent 4cae782 commit f82eb21
Show file tree
Hide file tree
Showing 136 changed files with 199 additions and 183 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,5 +41,6 @@
$rectorConfig->skip([
ExceptionHandlerTypehintRector::class,
PreferPHPUnitThisCallRector::class,
NarrowUnusedSetUpDefinedPropertyRector::class,
]);
};
2 changes: 1 addition & 1 deletion src/Action/AppendFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class AppendFormFieldElementAction
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private AdminHelper $helper
private AdminHelper $helper,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/DashboardAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class DashboardAction
public function __construct(
private array $dashboardBlocks,
private TemplateRegistryInterface $templateRegistry,
private Environment $twig
private Environment $twig,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/GetShortObjectDescriptionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class GetShortObjectDescriptionAction
{
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher
private AdminFetcherInterface $adminFetcher,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Action/RetrieveAutocompleteItemsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
final class RetrieveAutocompleteItemsAction
{
public function __construct(
private AdminFetcherInterface $adminFetcher
private AdminFetcherInterface $adminFetcher,
) {
}

Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/Action/RetrieveFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class RetrieveFormFieldElementAction
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private AdminHelper $helper
private AdminHelper $helper,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/SearchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class SearchAction
public function __construct(
private Pool $pool,
private TemplateRegistryInterface $templateRegistry,
private Environment $twig
private Environment $twig,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, AdminInterface<object>> $this->children
*/
final public function hasChildren(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AbstractAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function configureActionButtons(
AdminInterface $admin,
array $list,
string $action,
?object $object = null
?object $object = null,
): array {
return $list;
}
Expand Down
7 changes: 5 additions & 2 deletions src/Admin/AdminExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
*
* @method void preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements)
*
* @phpstan-method void preBatchAction(AdminInterface<T> $admin, string $actionName, ProxyQueryInterface<T> $query, array<mixed> &$idx, bool $allElements)
*
* @phpstan-template T of object
*/
interface AdminExtensionInterface
Expand Down Expand Up @@ -68,7 +70,7 @@ public function configureTabMenu(
AdminInterface $admin,
MenuItemInterface $menu,
string $action,
?AdminInterface $childAdmin = null
?AdminInterface $childAdmin = null,
): void;

/**
Expand Down Expand Up @@ -137,6 +139,7 @@ public function configureBatchActions(AdminInterface $admin, array $actions): ar
// /**
// * @param mixed[] $idx
// * @phpstan-param AdminInterface<T> $admin
// * @phpstan-param ProxyQueryInterface<T> $query
// */
// public function preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements): void;

Expand Down Expand Up @@ -203,7 +206,7 @@ public function configureActionButtons(
AdminInterface $admin,
array $list,
string $action,
?object $object = null
?object $object = null,
): array;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AdminHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AdminHelper
private const FORM_FIELD_DELETE = '_delete';

public function __construct(
private PropertyAccessorInterface $propertyAccessor
private PropertyAccessorInterface $propertyAccessor,
) {
}

Expand Down
2 changes: 2 additions & 0 deletions src/Admin/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* @method bool showInDashboard()
* @method void removeExtension(AdminExtensionInterface $extension)
*
* @phpstan-method void removeExtension(AdminExtensionInterface<T> $extension)
*
* @phpstan-import-type FieldDescriptionOptions from FieldDescriptionInterface
*
* @phpstan-template T of object
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/BreadcrumbsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -161,7 +161,7 @@ private function createMenuItem(
ItemInterface $menu,
string $name,
?string $translationDomain = null,
array $options = []
array $options = [],
): ItemInterface {
$options = array_merge([
'extras' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct(
private ContainerInterface $container,
private array $adminServiceCodes = [],
private array $adminGroups = [],
private array $adminClasses = []
private array $adminClasses = [],
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/UrlGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function generateObjectUrl(
string $name,
object $object,
array $parameters = [],
int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH
int $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH,
): string;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ArgumentResolver/AdminValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
final class AdminValueResolver implements CompatibleValueResolverInterface
{
public function __construct(
private AdminFetcherInterface $adminFetcher
private AdminFetcherInterface $adminFetcher,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminListBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminPreviewBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class AdminPreviewBlockService extends AbstractBlockService
{
public function __construct(
Environment $twig,
private Pool $pool
private Pool $pool,
) {
parent::__construct($twig);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminSearchBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminStatsBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class AdminStatsBlockService extends AbstractBlockService
{
public function __construct(
Environment $twig,
private Pool $pool
private Pool $pool,
) {
parent::__construct($twig);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Exporter/AdminExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
final class AdminExporter
{
public function __construct(
private ExporterInterface $exporter
private ExporterInterface $exporter,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Builder/AbstractFormContractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/DatagridBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface DatagridBuilderInterface extends BuilderInterface
public function addFilter(
DatagridInterface $datagrid,
?string $type,
FieldDescriptionInterface $fieldDescription
FieldDescriptionInterface $fieldDescription,
): void;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/FormContractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function getFormBuilder(string $name, array $formOptions = []): FormBuild
public function getDefaultOptions(
?string $type,
FieldDescriptionInterface $fieldDescription,
array $formOptions = []
array $formOptions = [],
): array;
}
2 changes: 1 addition & 1 deletion src/Builder/ListBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public function buildField(?string $type, FieldDescriptionInterface $fieldDescri
public function addField(
FieldDescriptionCollection $list,
?string $type,
FieldDescriptionInterface $fieldDescription
FieldDescriptionInterface $fieldDescription,
): void;
}
2 changes: 1 addition & 1 deletion src/Builder/ShowBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public function getBaseList(array $options = []): FieldDescriptionCollection;
public function addField(
FieldDescriptionCollection $list,
?string $type,
FieldDescriptionInterface $fieldDescription
FieldDescriptionInterface $fieldDescription,
): void;
}
2 changes: 1 addition & 1 deletion src/Command/ExplainAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/GenerateObjectAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class GenerateObjectAclCommand extends QuestionableCommand
*/
public function __construct(
private Pool $pool,
private array $aclObjectManipulators
private array $aclObjectManipulators,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/QuestionableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final protected function askAndValidate(
OutputInterface $output,
string $questionText,
string $default,
callable $validator
callable $validator,
) {
$questionHelper = $this->getQuestionHelper();

Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SetupAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class SetupAclCommand extends Command
*/
public function __construct(
private Pool $pool,
private AdminAclManipulatorInterface $aclManipulator
private AdminAclManipulatorInterface $aclManipulator,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Datagrid/Datagrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct(
private FieldDescriptionCollection $columns,
private PagerInterface $pager,
private FormBuilderInterface $formBuilder,
private array $values = []
private array $values = [],
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Datagrid/DatagridMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class DatagridMapper implements MapperInterface
public function __construct(
private DatagridBuilderInterface $builder,
private DatagridInterface $datagrid,
private AdminInterface $admin
private AdminInterface $admin,
) {
}

Expand All @@ -63,7 +63,7 @@ public function add(
string $name,
?string $type = null,
array $filterOptions = [],
array $fieldDescriptionOptions = []
array $fieldDescriptionOptions = [],
): self {
if (
isset($fieldDescriptionOptions['role'])
Expand Down
2 changes: 1 addition & 1 deletion src/Datagrid/ListMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class ListMapper implements MapperInterface
public function __construct(
private ListBuilderInterface $builder,
private FieldDescriptionCollection $list,
private AdminInterface $admin
private AdminInterface $admin,
) {
}

Expand Down
Loading

0 comments on commit f82eb21

Please sign in to comment.