From 09174924f81cf80ebca5d410e047364362b55cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Fri, 13 Dec 2024 10:01:52 +0100 Subject: [PATCH 1/7] #14 Quality. Phpstan remove - '#type has no value type specified in iterable type#' - '#has parameter .* with no value type specified in iterable type#' - '#has no value type specified in iterable type array#' - '#configureOptions\(\) has no return type specified.#' - '#configure\(\) has no return type specified#' - '#process\(\) has no return type specified#' - '#should return Iterator but returns Traversable#' - '#Negated boolean expression is always false#' --- phpstan.neon | 8 -------- src/Admin/Filter/LogProcessFilter.php | 3 +++ src/Entity/ProcessExecution.php | 18 ++++++++++++++++- src/Entity/ProcessSchedule.php | 9 +++++++++ src/Entity/User.php | 3 +++ src/Http/Model/HttpProcessExecution.php | 3 +++ .../HttpProcessExecuteValueResolver.php | 3 +++ .../ProcessConfigurationValueResolver.php | 4 ++++ src/Manager/ProcessConfigurationsManager.php | 20 +++++++++++++++++++ src/Message/ProcessExecuteMessage.php | 3 +++ 10 files changed, 65 insertions(+), 9 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index fbfff5e..8b167d3 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,14 +6,6 @@ parameters: excludePaths: - src/DependencyInjection/Configuration.php ignoreErrors: - - '#type has no value type specified in iterable type#' - - '#has parameter .* with no value type specified in iterable type#' - - '#has no value type specified in iterable type array#' - - '#configureOptions\(\) has no return type specified.#' - - '#configure\(\) has no return type specified#' - - '#process\(\) has no return type specified#' - - '#should return Iterator but returns Traversable#' - - '#Negated boolean expression is always false#' - identifier: missingType.generics - diff --git a/src/Admin/Filter/LogProcessFilter.php b/src/Admin/Filter/LogProcessFilter.php index c11c74e..15aac0e 100644 --- a/src/Admin/Filter/LogProcessFilter.php +++ b/src/Admin/Filter/LogProcessFilter.php @@ -26,6 +26,9 @@ class LogProcessFilter implements FilterInterface { use FilterTrait; + /** + * @param string[] $choices + */ public static function new( mixed $label, array $choices, diff --git a/src/Entity/ProcessExecution.php b/src/Entity/ProcessExecution.php index 2c51aa8..a924eda 100644 --- a/src/Entity/ProcessExecution.php +++ b/src/Entity/ProcessExecution.php @@ -40,9 +40,15 @@ class ProcessExecution implements \Stringable #[ORM\Column(type: Types::STRING, enumType: ProcessExecutionStatus::class)] public ProcessExecutionStatus $status = ProcessExecutionStatus::Started; + /** + * @var array + */ #[ORM\Column(type: Types::JSON)] private array $report = []; + /** + * @var array + */ #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $context = []; @@ -51,9 +57,13 @@ public function getId(): ?int return $this->id; } + /** + * @param array $context + */ public function __construct( string $code, - #[ORM\Column(type: Types::STRING, length: 255)] public readonly string $logFilename, ?array $context = [], + #[ORM\Column(type: Types::STRING, length: 255)] public readonly string $logFilename, + ?array $context = [], ) { $this->code = (string) (new UnicodeString($code))->truncate(255); $this->startDate = \DateTimeImmutable::createFromMutable(new \DateTime()); @@ -104,11 +114,17 @@ public function getCode(): string return $this->code; } + /** + * @return array + */ public function getContext(): ?array { return $this->context; } + /** + * @param array $context + */ public function setContext(array $context): void { $this->context = $context; diff --git a/src/Entity/ProcessSchedule.php b/src/Entity/ProcessSchedule.php index 5eed3d6..0637a4a 100644 --- a/src/Entity/ProcessSchedule.php +++ b/src/Entity/ProcessSchedule.php @@ -48,6 +48,9 @@ class ProcessSchedule #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $input = null; + /** + * @var string|array + */ #[ORM\Column(type: Types::JSON)] private string|array $context = []; @@ -68,11 +71,17 @@ public function setProcess(string $process): static return $this; } + /** + * @return array + */ public function getContext(): array { return \is_array($this->context) ? $this->context : json_decode($this->context); } + /** + * @param array $context + */ public function setContext(array $context): void { $this->context = $context; diff --git a/src/Entity/User.php b/src/Entity/User.php index b59be10..a5f680c 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -37,6 +37,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $lastname = null; + /** + * @var string[] + */ #[ORM\Column(type: Types::JSON)] private array $roles = []; diff --git a/src/Http/Model/HttpProcessExecution.php b/src/Http/Model/HttpProcessExecution.php index d6fbeea..fc4272f 100644 --- a/src/Http/Model/HttpProcessExecution.php +++ b/src/Http/Model/HttpProcessExecution.php @@ -19,6 +19,9 @@ final readonly class HttpProcessExecution { + /** + * @param array $context + */ public function __construct( #[Sequentially(constraints: [new NotNull(message: 'Process code is required.'), new IsValidProcessCode()])] public ?string $code = null, diff --git a/src/Http/ValueResolver/HttpProcessExecuteValueResolver.php b/src/Http/ValueResolver/HttpProcessExecuteValueResolver.php index 13d5584..5e2aafe 100644 --- a/src/Http/ValueResolver/HttpProcessExecuteValueResolver.php +++ b/src/Http/ValueResolver/HttpProcessExecuteValueResolver.php @@ -28,6 +28,9 @@ public function __construct(private string $storageDir) { } + /** + * @return iterable + */ public function resolve(Request $request, ArgumentMetadata $argument): iterable { $input = $request->get('input', $request->files->get('input')); diff --git a/src/Http/ValueResolver/ProcessConfigurationValueResolver.php b/src/Http/ValueResolver/ProcessConfigurationValueResolver.php index 3290d9b..bf88b84 100644 --- a/src/Http/ValueResolver/ProcessConfigurationValueResolver.php +++ b/src/Http/ValueResolver/ProcessConfigurationValueResolver.php @@ -13,6 +13,7 @@ namespace CleverAge\UiProcessBundle\Http\ValueResolver; +use CleverAge\ProcessBundle\Configuration\ProcessConfiguration; use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Attribute\AsTargetedValueResolver; @@ -26,6 +27,9 @@ public function __construct(private ProcessConfigurationRegistry $registry) { } + /** + * @return iterable + */ public function resolve(Request $request, ArgumentMetadata $argument): iterable { return [$this->registry->getProcessConfiguration($request->get('process'))]; diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index 82dc3db..d057468 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -18,7 +18,19 @@ use CleverAge\ProcessBundle\Validator\ConstraintLoader; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Validator\Constraint; +/** + * @template UiOptions of array{ + * 'source': ?string, + * 'target': ?string, + * 'entrypoint_type': 'text|file', + * 'constraints': Constraint[], + * 'run': 'null|bool', + * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * } + * @template UiOptionList of array {'ui': UiOptions} + */ final readonly class ProcessConfigurationsManager { public function __construct(private ProcessConfigurationRegistry $registry) @@ -37,6 +49,9 @@ public function getPrivateProcesses(): array return array_filter($this->getConfigurations(), fn (ProcessConfiguration $cfg) => !$cfg->isPublic()); } + /** + * @return null|UiOptions + */ public function getUiOptions(string $processCode): ?array { if (false === $this->registry->hasProcessConfiguration($processCode)) { @@ -48,6 +63,11 @@ public function getUiOptions(string $processCode): ?array return $this->resolveUiOptions($configuration->getOptions())['ui']; } + /** + * @param array $options + * + * @return UiOptionList + */ private function resolveUiOptions(array $options): array { $resolver = new OptionsResolver(); diff --git a/src/Message/ProcessExecuteMessage.php b/src/Message/ProcessExecuteMessage.php index 397f0ae..84fddb0 100644 --- a/src/Message/ProcessExecuteMessage.php +++ b/src/Message/ProcessExecuteMessage.php @@ -15,6 +15,9 @@ readonly class ProcessExecuteMessage { + /** + * @param mixed[] $context + */ public function __construct(public string $code, public mixed $input, public array $context = []) { } From dffccf24552183e3a22fd89b0b252a2356de5798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Fri, 13 Dec 2024 10:38:13 +0100 Subject: [PATCH 2/7] #14 Quality. Phpstan remove missingType.generics --- phpstan.neon | 2 -- src/Form/Type/LaunchType.php | 1 + src/Form/Type/ProcessContextType.php | 1 + src/Form/Type/ProcessUploadFileType.php | 1 + src/Manager/ProcessConfigurationsManager.php | 31 +++++++++++-------- .../ProcessExecutionExtensionRuntime.php | 1 + 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 8b167d3..030748e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,8 +6,6 @@ parameters: excludePaths: - src/DependencyInjection/Configuration.php ignoreErrors: - - - identifier: missingType.generics - identifier: doctrine.columnType reportUnmatchedIgnoredErrors: false diff --git a/src/Form/Type/LaunchType.php b/src/Form/Type/LaunchType.php index 5ca2489..9c2f964 100644 --- a/src/Form/Type/LaunchType.php +++ b/src/Form/Type/LaunchType.php @@ -25,6 +25,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +/** @template-extends AbstractType> */ class LaunchType extends AbstractType { public function __construct( diff --git a/src/Form/Type/ProcessContextType.php b/src/Form/Type/ProcessContextType.php index e8e2c2d..d95fd19 100644 --- a/src/Form/Type/ProcessContextType.php +++ b/src/Form/Type/ProcessContextType.php @@ -18,6 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\NotBlank; +/** @template-extends AbstractType */ class ProcessContextType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Type/ProcessUploadFileType.php b/src/Form/Type/ProcessUploadFileType.php index 88b77c1..57619ff 100644 --- a/src/Form/Type/ProcessUploadFileType.php +++ b/src/Form/Type/ProcessUploadFileType.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\OptionsResolver\OptionsResolver; +/** @template-extends AbstractType */ class ProcessUploadFileType extends AbstractType { public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index d057468..d3d9bd8 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -20,17 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraint; -/** - * @template UiOptions of array{ - * 'source': ?string, - * 'target': ?string, - * 'entrypoint_type': 'text|file', - * 'constraints': Constraint[], - * 'run': 'null|bool', - * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} - * } - * @template UiOptionList of array {'ui': UiOptions} - */ final readonly class ProcessConfigurationsManager { public function __construct(private ProcessConfigurationRegistry $registry) @@ -50,7 +39,14 @@ public function getPrivateProcesses(): array } /** - * @return null|UiOptions + * @return null|array{ + * 'source': ?string, + * 'target': ?string, + * 'entrypoint_type': 'text|file', + * 'constraints': Constraint[], + * 'run': 'null|bool', + * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * } */ public function getUiOptions(string $processCode): ?array { @@ -66,7 +62,16 @@ public function getUiOptions(string $processCode): ?array /** * @param array $options * - * @return UiOptionList + * @return array{ + * 'ui': array{ + * 'source': ?string, + * 'target': ?string, + * 'entrypoint_type': 'text|file', + * 'constraints': Constraint[], + * 'run': 'null|bool', + * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * } + * } */ private function resolveUiOptions(array $options): array { diff --git a/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php b/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php index 592f1e4..60f8630 100644 --- a/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php +++ b/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php @@ -16,6 +16,7 @@ use CleverAge\UiProcessBundle\Entity\ProcessExecution; use CleverAge\UiProcessBundle\Manager\ProcessConfigurationsManager; use CleverAge\UiProcessBundle\Repository\ProcessExecutionRepository; +use Symfony\Component\Form\AbstractType; use Twig\Extension\RuntimeExtensionInterface; readonly class ProcessExecutionExtensionRuntime implements RuntimeExtensionInterface From 92dd52b501970fb3bbdb53c112b1fae15a718391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Fri, 13 Dec 2024 10:40:50 +0100 Subject: [PATCH 3/7] #14 Quality. Phpstan 7 --- phpstan.neon | 2 +- src/Manager/ProcessConfigurationsManager.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 030748e..9f60d1c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 6 + level: 7 paths: - src - tests diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index d3d9bd8..8c260f6 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -102,8 +102,21 @@ private function resolveUiOptions(array $options): array $uiResolver->setAllowedValues('entrypoint_type', ['text', 'file']); $uiResolver->setNormalizer('constraints', fn (Options $options, array $values): array => (new ConstraintLoader())->buildConstraints($values)); }); + /** + * @var array{ + * 'ui': array{ + * 'source': ?string, + * 'target': ?string, + * 'entrypoint_type': 'text|file', + * 'constraints': Constraint[], + * 'run': 'null|bool', + * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * } + * } $options + */ + $options = $resolver->resolve($options); - return $resolver->resolve($options); + return $options; } /** @return ProcessConfiguration[] */ From 0d0e7cf503fc3c3e082be0fd9b3ca49a1469b050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Fri, 13 Dec 2024 14:32:47 +0100 Subject: [PATCH 4/7] #14 Quality. Phpstan 8 --- phpstan.neon | 10 +--------- src/Entity/ProcessSchedule.php | 6 +++--- src/Entity/User.php | 4 ++-- src/Form/Type/LaunchType.php | 16 +++++++++------- src/Manager/ProcessConfigurationsManager.php | 4 ++-- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 9f60d1c..1cd333b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,13 +1,5 @@ parameters: - level: 7 + level: 8 paths: - src - tests - excludePaths: - - src/DependencyInjection/Configuration.php - ignoreErrors: - - - identifier: doctrine.columnType - reportUnmatchedIgnoredErrors: false - inferPrivatePropertyTypeFromConstructor: true - treatPhpDocTypesAsCertain: false diff --git a/src/Entity/ProcessSchedule.php b/src/Entity/ProcessSchedule.php index 0637a4a..4ffa00a 100644 --- a/src/Entity/ProcessSchedule.php +++ b/src/Entity/ProcessSchedule.php @@ -32,7 +32,7 @@ class ProcessSchedule #[ORM\Column(length: 255)] #[IsValidProcessCode] - private ?string $process = null; + private string $process; #[ORM\Column(length: 6)] private ProcessScheduleType $type; @@ -43,7 +43,7 @@ class ProcessSchedule #[Assert\When( expression: 'this.getType().value == "every"', constraints: [new EveryExpression()] )] - private ?string $expression = null; + private string $expression; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $input = null; @@ -109,7 +109,7 @@ public function getExpression(): ?string return $this->expression; } - public function setExpression(?string $expression): self + public function setExpression(string $expression): self { $this->expression = $expression; diff --git a/src/Entity/User.php b/src/Entity/User.php index a5f680c..11532f7 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -29,7 +29,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?int $id = null; #[ORM\Column(type: Types::STRING, length: 255, unique: true)] - private ?string $email = null; + private string $email; #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $firstname = null; @@ -98,7 +98,7 @@ public function setLastname(?string $lastname): self public function getUserIdentifier(): string { - if (null === $this->email || '' === $this->email || '0' === $this->email) { + if ('' === $this->email) { throw new \LogicException('The User class must have an email.'); } diff --git a/src/Form/Type/LaunchType.php b/src/Form/Type/LaunchType.php index 9c2f964..3c876bc 100644 --- a/src/Form/Type/LaunchType.php +++ b/src/Form/Type/LaunchType.php @@ -39,13 +39,15 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $code = $options['process_code']; $configuration = $this->registry->getProcessConfiguration($code); $uiOptions = $this->configurationsManager->getUiOptions($code); - $builder->add( - 'input', - 'file' === ($uiOptions['entrypoint_type'] ?? null) ? FileType::class : TextType::class, - [ - 'required' => $configuration->getEntryPoint() instanceof TaskConfiguration, - ] - ); + if (isset($uiOptions['entrypoint_type'])) { + $builder->add( + 'input', + 'file' === $uiOptions['entrypoint_type'] ? FileType::class : TextType::class, + [ + 'required' => $configuration->getEntryPoint() instanceof TaskConfiguration, + ] + ); + } $builder->add( 'context', CollectionType::class, diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index 8c260f6..f3cc54c 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -42,7 +42,7 @@ public function getPrivateProcesses(): array * @return null|array{ * 'source': ?string, * 'target': ?string, - * 'entrypoint_type': 'text|file', + * 'entrypoint_type': string, * 'constraints': Constraint[], * 'run': 'null|bool', * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} @@ -66,7 +66,7 @@ public function getUiOptions(string $processCode): ?array * 'ui': array{ * 'source': ?string, * 'target': ?string, - * 'entrypoint_type': 'text|file', + * 'entrypoint_type': string, * 'constraints': Constraint[], * 'run': 'null|bool', * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} From 5d29fef34d1494d65d1e93d8edd00c32ad4c6e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Fri, 13 Dec 2024 14:55:29 +0100 Subject: [PATCH 5/7] #14 Quality. PhpCs --- src/Entity/ProcessSchedule.php | 2 +- src/Twig/Runtime/ProcessExecutionExtensionRuntime.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Entity/ProcessSchedule.php b/src/Entity/ProcessSchedule.php index 4ffa00a..8eea928 100644 --- a/src/Entity/ProcessSchedule.php +++ b/src/Entity/ProcessSchedule.php @@ -80,7 +80,7 @@ public function getContext(): array } /** - * @param array $context + * @param array $context */ public function setContext(array $context): void { diff --git a/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php b/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php index 60f8630..592f1e4 100644 --- a/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php +++ b/src/Twig/Runtime/ProcessExecutionExtensionRuntime.php @@ -16,7 +16,6 @@ use CleverAge\UiProcessBundle\Entity\ProcessExecution; use CleverAge\UiProcessBundle\Manager\ProcessConfigurationsManager; use CleverAge\UiProcessBundle\Repository\ProcessExecutionRepository; -use Symfony\Component\Form\AbstractType; use Twig\Extension\RuntimeExtensionInterface; readonly class ProcessExecutionExtensionRuntime implements RuntimeExtensionInterface From 06b69a7c8b046aa51b68ab69afb498b4c7b30f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Mon, 16 Dec 2024 14:18:42 +0100 Subject: [PATCH 6/7] #14 Quality. Phpstan use phpstan type to prevent duplicate definitions. --- src/Manager/ProcessConfigurationsManager.php | 41 +++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index f3cc54c..4c4106d 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -20,6 +20,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraint; +/** + * @phpstan-type UiOptions array{ + * 'source': ?string, + * 'target': ?string, + * 'entrypoint_type': string, + * 'constraints': Constraint[], + * 'run': 'null|bool', + * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * } + */ final readonly class ProcessConfigurationsManager { public function __construct(private ProcessConfigurationRegistry $registry) @@ -39,14 +49,7 @@ public function getPrivateProcesses(): array } /** - * @return null|array{ - * 'source': ?string, - * 'target': ?string, - * 'entrypoint_type': string, - * 'constraints': Constraint[], - * 'run': 'null|bool', - * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} - * } + * @return null|UiOptions */ public function getUiOptions(string $processCode): ?array { @@ -62,16 +65,7 @@ public function getUiOptions(string $processCode): ?array /** * @param array $options * - * @return array{ - * 'ui': array{ - * 'source': ?string, - * 'target': ?string, - * 'entrypoint_type': string, - * 'constraints': Constraint[], - * 'run': 'null|bool', - * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} - * } - * } + * @return array{'ui': UiOptions} */ private function resolveUiOptions(array $options): array { @@ -103,16 +97,7 @@ private function resolveUiOptions(array $options): array $uiResolver->setNormalizer('constraints', fn (Options $options, array $values): array => (new ConstraintLoader())->buildConstraints($values)); }); /** - * @var array{ - * 'ui': array{ - * 'source': ?string, - * 'target': ?string, - * 'entrypoint_type': 'text|file', - * 'constraints': Constraint[], - * 'run': 'null|bool', - * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} - * } - * } $options + * @var array{'ui': UiOptions} $options */ $options = $resolver->resolve($options); From f4bdfbbc309f065ab518f53d834fadfe7b5ba00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Mon, 16 Dec 2024 14:21:44 +0100 Subject: [PATCH 7/7] #14 Quality. Phpstan use phpstan type to prevent duplicate definitions. --- src/Manager/ProcessConfigurationsManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index 4c4106d..2db160e 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -49,7 +49,7 @@ public function getPrivateProcesses(): array } /** - * @return null|UiOptions + * @return UiOptions|null */ public function getUiOptions(string $processCode): ?array {