From fb06e46485c3f68d9114880a53ea68a1605980ac Mon Sep 17 00:00:00 2001 From: Sonata CI Date: Tue, 6 Feb 2024 06:32:42 +0000 Subject: [PATCH] DevKit updates for 4.x branch (#8159) Co-authored-by: Vincent Langlet --- rector.php | 3 +-- src/Admin/AbstractAdmin.php | 2 +- src/Admin/AdminInterface.php | 4 +--- src/Exception/BadRequestParamHttpException.php | 3 +-- src/Filter/Filter.php | 8 ++++---- src/Filter/FilterInterface.php | 18 ++++-------------- src/Object/Metadata.php | 2 +- src/Route/AdminPoolLoader.php | 10 ++-------- 8 files changed, 15 insertions(+), 35 deletions(-) diff --git a/rector.php b/rector.php index 2456d3ec54..93a605cc63 100644 --- a/rector.php +++ b/rector.php @@ -21,7 +21,6 @@ use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; -use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -33,7 +32,7 @@ $rectorConfig->sets([ LevelSetList::UP_TO_PHP_80, - PHPUnitLevelSetList::UP_TO_PHPUNIT_90, + PHPUnitSetList::PHPUNIT_90, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 7cc0185fc1..5708dee7b0 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -1413,7 +1413,7 @@ final public function getPersistentParameters(): array return $parameters; } - final public function getPersistentParameter(string $name, $default = null) + final public function getPersistentParameter(string $name, mixed $default = null) { $parameters = $this->getPersistentParameters(); diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 6399061892..eb92167643 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -435,11 +435,9 @@ public function getBatchActions(): array; public function getPersistentParameters(): array; /** - * @param mixed $default - * * @return mixed */ - public function getPersistentParameter(string $name, $default = null); + public function getPersistentParameter(string $name, mixed $default = null); /** * Set the current child status. diff --git a/src/Exception/BadRequestParamHttpException.php b/src/Exception/BadRequestParamHttpException.php index 8c4f23877e..820d05c54f 100644 --- a/src/Exception/BadRequestParamHttpException.php +++ b/src/Exception/BadRequestParamHttpException.php @@ -22,12 +22,11 @@ final class BadRequestParamHttpException extends BadRequestHttpException { /** * @param string|string[] $expectedTypes - * @param mixed $value */ public function __construct( string $name, $expectedTypes, - $value + mixed $value ) { if (!\is_array($expectedTypes)) { $expectedTypes = [$expectedTypes]; diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index e66bee7adb..e54be96277 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -72,7 +72,7 @@ final public function getFormName(): string return str_replace('.', '__', $this->getName()); } - final public function getOption(string $name, $default = null) + final public function getOption(string $name, mixed $default = null) { if (\array_key_exists($name, $this->options)) { return $this->options[$name]; @@ -81,7 +81,7 @@ final public function getOption(string $name, $default = null) return $default; } - final public function setOption(string $name, $value): void + final public function setOption(string $name, mixed $value): void { $this->options[$name] = $value; } @@ -96,7 +96,7 @@ final public function getFieldOptions(): array return $this->getOption('field_options', []); } - final public function getFieldOption(string $name, $default = null) + final public function getFieldOption(string $name, mixed $default = null) { if (isset($this->options['field_options'][$name]) && \is_array($this->options['field_options'])) { return $this->options['field_options'][$name]; @@ -105,7 +105,7 @@ final public function getFieldOption(string $name, $default = null) return $default; } - final public function setFieldOption(string $name, $value): void + final public function setFieldOption(string $name, mixed $value): void { $this->options['field_options'][$name] = $value; } diff --git a/src/Filter/FilterInterface.php b/src/Filter/FilterInterface.php index 4621f62464..74479309d8 100644 --- a/src/Filter/FilterInterface.php +++ b/src/Filter/FilterInterface.php @@ -66,16 +66,11 @@ public function getDefaultOptions(): array; public function getOptions(): array; /** - * @param mixed $default - * * @return mixed */ - public function getOption(string $name, $default = null); + public function getOption(string $name, mixed $default = null); - /** - * @param mixed $value - */ - public function setOption(string $name, $value): void; + public function setOption(string $name, mixed $value): void; /** * @param array $options @@ -112,16 +107,11 @@ public function getAssociationMapping(): array; public function getFieldOptions(): array; /** - * @param mixed $default - * * @return mixed */ - public function getFieldOption(string $name, $default = null); + public function getFieldOption(string $name, mixed $default = null); - /** - * @param mixed $value - */ - public function setFieldOption(string $name, $value): void; + public function setFieldOption(string $name, mixed $value): void; public function getFieldType(): string; diff --git a/src/Object/Metadata.php b/src/Object/Metadata.php index 60554d80e4..ac49ff937e 100644 --- a/src/Object/Metadata.php +++ b/src/Object/Metadata.php @@ -65,7 +65,7 @@ public function getOptions(): array return $this->options; } - public function getOption($name, $default = null) + public function getOption($name, mixed $default = null) { return \array_key_exists($name, $this->options) ? $this->options[$name] : $default; } diff --git a/src/Route/AdminPoolLoader.php b/src/Route/AdminPoolLoader.php index 125a949e92..f8ce5e4adb 100644 --- a/src/Route/AdminPoolLoader.php +++ b/src/Route/AdminPoolLoader.php @@ -33,18 +33,12 @@ public function __construct( parent::__construct(); } - /** - * @param mixed $resource - */ - public function supports($resource, ?string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { return self::ROUTE_TYPE_NAME === $type; } - /** - * @param mixed $resource - */ - public function load($resource, ?string $type = null): SymfonyRouteCollection + public function load(mixed $resource, ?string $type = null): SymfonyRouteCollection { $collection = new SymfonyRouteCollection(); foreach ($this->pool->getAdminServiceCodes() as $code) {