From 1df71c0070e9da15fcae634a11494f9beb6e6f12 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 17 Dec 2023 20:10:57 +0000 Subject: [PATCH] DevKit updates --- .php-cs-fixer.dist.php | 14 +++++++------- src/Controller/CRUDController.php | 3 ++- src/FieldDescription/BaseFieldDescription.php | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1afe2e232d..d197afd5b3 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -27,8 +27,9 @@ HEADER; $rules = [ - '@PHP74Migration' => true, - '@PHP74Migration:risky' => true, + '@PHP80Migration' => true, + '@PHP80Migration:risky' => true, + '@PHPUnit84Migration:risky' => true, '@PSR12' => true, '@PSR12:risky' => true, '@Symfony' => true, @@ -42,6 +43,7 @@ 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], 'no_useless_else' => true, 'no_useless_return' => true, + 'no_superfluous_elseif' => true, 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true], 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true], 'ordered_class_elements' => true, @@ -51,16 +53,14 @@ ['phpstan-template', 'phpstan-template-covariant', 'phpstan-extends', 'phpstan-implements', 'phpstan-var', 'psalm-var', 'phpstan-param', 'psalm-param', 'phpstan-return', 'psalm-return'], ['psalm-suppress', 'phpstan-ignore-next-line'], ['Assert\\*'], - ['ODM\\*'], - ['ORM\\*'], ]], - 'php_unit_strict' => true, - 'php_unit_test_case_static_method_calls' => true, 'php_unit_data_provider_name' => true, 'php_unit_data_provider_return_type' => true, + 'php_unit_strict' => true, + 'php_unit_test_case_static_method_calls' => true, 'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var']], - 'single_line_throw' => false, 'static_lambda' => true, + 'single_line_throw' => false, 'strict_comparison' => true, 'strict_param' => true, 'void_return' => false, diff --git a/src/Controller/CRUDController.php b/src/Controller/CRUDController.php index 888664370b..7e39194ee7 100644 --- a/src/Controller/CRUDController.php +++ b/src/Controller/CRUDController.php @@ -1457,7 +1457,8 @@ final protected function assertObjectExists(Request $request, bool $strict = fal $admin->getClassnameLabel(), $objectId )); - } elseif (null === $object) { + } + if (null === $object) { /** @phpstan-var T $object */ $object = $adminObject; } diff --git a/src/FieldDescription/BaseFieldDescription.php b/src/FieldDescription/BaseFieldDescription.php index 947c4336be..6e27f15f5a 100644 --- a/src/FieldDescription/BaseFieldDescription.php +++ b/src/FieldDescription/BaseFieldDescription.php @@ -416,7 +416,8 @@ final protected function getFieldValue(?object $object, string $fieldName) $accessor = $this->getOption('accessor', $fieldName); if (!\is_string($accessor) && \is_callable($accessor)) { return $accessor($object); - } elseif (!\is_string($accessor) && !$accessor instanceof PropertyPathInterface) { + } + if (!\is_string($accessor) && !$accessor instanceof PropertyPathInterface) { throw new \TypeError(sprintf( 'The option "accessor" must be a string, a callable or a %s, %s given.', PropertyPathInterface::class,