Skip to content

Commit 06b69a7

Browse files
#14 Quality. Phpstan use phpstan type to prevent duplicate definitions.
1 parent 5d29fef commit 06b69a7

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

src/Manager/ProcessConfigurationsManager.php

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
use Symfony\Component\OptionsResolver\OptionsResolver;
2121
use Symfony\Component\Validator\Constraint;
2222

23+
/**
24+
* @phpstan-type UiOptions array{
25+
* 'source': ?string,
26+
* 'target': ?string,
27+
* 'entrypoint_type': string,
28+
* 'constraints': Constraint[],
29+
* 'run': 'null|bool',
30+
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
31+
* }
32+
*/
2333
final readonly class ProcessConfigurationsManager
2434
{
2535
public function __construct(private ProcessConfigurationRegistry $registry)
@@ -39,14 +49,7 @@ public function getPrivateProcesses(): array
3949
}
4050

4151
/**
42-
* @return null|array{
43-
* 'source': ?string,
44-
* 'target': ?string,
45-
* 'entrypoint_type': string,
46-
* 'constraints': Constraint[],
47-
* 'run': 'null|bool',
48-
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
49-
* }
52+
* @return null|UiOptions
5053
*/
5154
public function getUiOptions(string $processCode): ?array
5255
{
@@ -62,16 +65,7 @@ public function getUiOptions(string $processCode): ?array
6265
/**
6366
* @param array<int|string, mixed> $options
6467
*
65-
* @return array{
66-
* 'ui': array{
67-
* 'source': ?string,
68-
* 'target': ?string,
69-
* 'entrypoint_type': string,
70-
* 'constraints': Constraint[],
71-
* 'run': 'null|bool',
72-
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
73-
* }
74-
* }
68+
* @return array{'ui': UiOptions}
7569
*/
7670
private function resolveUiOptions(array $options): array
7771
{
@@ -103,16 +97,7 @@ private function resolveUiOptions(array $options): array
10397
$uiResolver->setNormalizer('constraints', fn (Options $options, array $values): array => (new ConstraintLoader())->buildConstraints($values));
10498
});
10599
/**
106-
* @var array{
107-
* 'ui': array{
108-
* 'source': ?string,
109-
* 'target': ?string,
110-
* 'entrypoint_type': 'text|file',
111-
* 'constraints': Constraint[],
112-
* 'run': 'null|bool',
113-
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
114-
* }
115-
* } $options
100+
* @var array{'ui': UiOptions} $options
116101
*/
117102
$options = $resolver->resolve($options);
118103

0 commit comments

Comments
 (0)