Skip to content

Commit d764d5b

Browse files
committed
Fix linter issues and bump symfony dev-dependencies
1 parent 3170863 commit d764d5b

17 files changed

Lines changed: 73 additions & 47 deletions

src/Configuration/Factory/JsonConfiguration/JsonConfigValidator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
public function __construct(
3030
string $jsonSchemaPathname = self::JSON_SCHEMA_PATHNAME,
3131
) {
32+
/** @phpstan-ignore assign.propertyType */
3233
$this->validator = new JustInRainbowJsonSchemaValidator($jsonSchemaPathname);
3334
}
3435

src/Target/LinuxBuiltinTarget.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ protected function getRuntimeBinaryFilename(): string
7272
{
7373
return match ($this->arch) {
7474
BuiltinArchitectureTarget::Amd64 => self::DEFAULT_RUNTIME_AMD64_BINARY_NAME,
75+
/** @phpstan-ignore-next-line : Allow default match arm */
7576
BuiltinArchitectureTarget::Arm64 => self::DEFAULT_RUNTIME_ARM64_BINARY_NAME,
7677
default => throw new \InvalidArgumentException(\sprintf(
7778
'Unsupported architecture "%s"',
79+
/** @phpstan-ignore-next-line : Backed enum's value is always string|int */
7880
$this->arch->value,
7981
)),
8082
};
@@ -88,22 +90,23 @@ protected function getSfxExtensionMapping(): array
8890
];
8991
}
9092

91-
/**
92-
* @return non-empty-string
93-
*/
9493
protected function getSfxFilename(string $edition): string
9594
{
9695
return match ($this->arch) {
9796
BuiltinArchitectureTarget::Amd64 => match ($edition) {
9897
self::MINIMAL_EDITION => 'linux-x86_64.min.sfx',
9998
self::STANDARD_EDITION => 'linux-x86_64.standard.sfx',
99+
default => throw new \RuntimeException(\sprintf('Unsupported edition "%s"', $edition)),
100100
},
101+
/** @phpstan-ignore-next-line : Allow default match arm */
101102
BuiltinArchitectureTarget::Arm64 => match ($edition) {
102103
self::MINIMAL_EDITION => 'linux-aarch64.min.sfx',
103104
self::STANDARD_EDITION => 'linux-aarch64.standard.sfx',
105+
default => throw new \RuntimeException(\sprintf('Unsupported edition "%s"', $edition)),
104106
},
105107
default => throw new \RuntimeException(\sprintf(
106108
'Unsupported architecture "%s"',
109+
/** @phpstan-ignore-next-line : Backed enum's value is always string|int */
107110
$this->arch->value,
108111
)),
109112
};

src/Target/MacOSBuiltinTarget.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,23 @@ protected function getSfxExtensionMapping(): array
7676
];
7777
}
7878

79-
/**
80-
* @return non-empty-string
81-
*/
8279
protected function getSfxFilename(string $edition): string
8380
{
8481
return match ($this->arch) {
8582
BuiltinArchitectureTarget::Amd64 => match ($edition) {
8683
self::MINIMAL_EDITION => 'macos-x86_64.min.sfx',
8784
self::STANDARD_EDITION => 'macos-x86_64.standard.sfx',
85+
default => throw new \RuntimeException(\sprintf('Unsupported edition "%s"', $edition)),
8886
},
87+
/** @phpstan-ignore-next-line : Allow default match arm */
8988
BuiltinArchitectureTarget::Arm64 => match ($edition) {
9089
self::MINIMAL_EDITION => 'macos-aarch64.min.sfx',
9190
self::STANDARD_EDITION => 'macos-aarch64.standard.sfx',
91+
default => throw new \RuntimeException(\sprintf('Unsupported edition "%s"', $edition)),
9292
},
9393
default => throw new \RuntimeException(\sprintf(
9494
'Unsupported architecture "%s"',
95+
/** @phpstan-ignore-next-line : Backed enum's value is always string|int */
9596
$this->arch->value,
9697
)),
9798
};

src/Target/TargetInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
interface TargetInterface extends \Stringable
1313
{
1414
/**
15-
* Gets target type
15+
* Gets a target type
1616
*
1717
* @var non-empty-string
1818
*/

src/Target/WindowsBuiltinTarget.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,13 @@ protected function getSfxExtensionMapping(): array
8282
];
8383
}
8484

85-
/**
86-
* @return non-empty-string
87-
*/
8885
protected function getSfxFilename(string $edition): string
8986
{
9087
return match ($this->arch) {
9188
BuiltinArchitectureTarget::Amd64 => match ($edition) {
9289
self::MINIMAL_EDITION => 'windows-x86_64.min.sfx',
9390
self::STANDARD_EDITION => 'windows-x86_64.standard.sfx',
91+
default => throw new \RuntimeException(\sprintf('Unsupported edition "%s"', $edition)),
9492
},
9593
default => throw new \RuntimeException(\sprintf(
9694
'Unsupported architecture "%s"',

src/Validator/JustInRainbowJsonSchemaValidator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* }>
2020
*
2121
* @template TSchema of array<array-key, mixed>
22+
* @template-implements FileValidatorInterface<TSchema>
2223
*/
2324
final readonly class JustInRainbowJsonSchemaValidator implements FileValidatorInterface
2425
{

src/Workflow/Runtime/WorkflowExecutor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
final readonly class WorkflowExecutor
1717
{
18-
/**
19-
* @var \ReflectionObject<TWorkflow>
20-
*/
2118
private \ReflectionObject $reflection;
2219

2320
public function __construct(

src/Workflow/Step/Step.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ private function getContextFromBacktrace(): ContextInterface
3838
}
3939

4040
return match (true) {
41-
isset($trace['class'], $trace['function']) => new MethodContext(
41+
isset($trace['class']) => new MethodContext(
4242
class: $trace['class'],
43+
/** @phpstan-ignore-next-line : Method name cannot be empty */
4344
method: $trace['function'],
4445
),
46+
/** @phpstan-ignore-next-line : Function name can be not defined in {main} context (?) */
4547
isset($trace['function']) => new FunctionContext(
48+
/** @phpstan-ignore-next-line : Function name cannot be empty */
4649
function: $trace['function'],
4750
),
4851
default => new GlobalContext(),

src/Workflow/Task.php

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ public static function run(Configuration $config, TaskInterface $task): mixed
4848
*
4949
* @param callable():TArgResult $context
5050
*
51-
* @return \Generator<mixed, array-key, Step, TArgResult>
51+
* @return \Generator<mixed, Step, Step, TArgResult>
5252
* @throws \Throwable
5353
*/
5454
public static function capture(callable $context): \Generator
5555
{
56-
return self::toCoroutine(new \Fiber($context));
56+
/** @var \Fiber<Step, Step, TArgResult, Step> $fiber */
57+
$fiber = new \Fiber($context);
58+
59+
return self::toCoroutine($fiber);
5760
}
5861

5962
/**
@@ -69,7 +72,7 @@ public static function notify(string $message, array $args = []): void
6972
}
7073

7174
try {
72-
\Fiber::suspend(new NotifyStep($message, $args));
75+
\Fiber::suspend(new NotifyStep($message, \array_values($args)));
7376
} catch (\Throwable) {
7477
// NO-OP
7578
}
@@ -88,7 +91,7 @@ public static function progress(string $message, array $args = []): void
8891
}
8992

9093
try {
91-
\Fiber::suspend(new ProgressStep($message, $args));
94+
\Fiber::suspend(new ProgressStep($message, \array_values($args)));
9295
} catch (\Throwable) {
9396
// NO-OP
9497
}
@@ -105,19 +108,19 @@ public static function info(string $message, array $args = []): void
105108
}
106109

107110
try {
108-
\Fiber::suspend(new InfoStep($message, $args));
111+
\Fiber::suspend(new InfoStep($message, \array_values($args)));
109112
} catch (\Throwable) {
110113
// NO-OP
111114
}
112115
}
113116

114117
/**
115-
* @template TArgStep of Step
118+
* @template TArgStep of Step|null
116119
* @template TArgResult of mixed
117120
*
118-
* @param \Fiber<null, null, TArgResult, TArgStep> $fiber
121+
* @param \Fiber<TArgStep, TArgStep, TArgResult, TArgStep> $fiber
119122
*
120-
* @return \Generator<null, array-key, TArgStep, TArgResult>
123+
* @return \Generator<array-key, TArgStep, TArgStep, TArgResult>
121124
* @throws \Throwable
122125
*/
123126
private static function toCoroutine(\Fiber $fiber): \Generator
@@ -129,26 +132,30 @@ private static function toCoroutine(\Fiber $fiber): \Generator
129132
}
130133

131134
if (!$fiber->isStarted()) {
135+
/** @phpstan-ignore generator.valueType */
132136
$value = yield $fiber->start();
133137
}
134138

135-
if (!$fiber->isTerminated()) {
136-
while (true) {
137-
$value = $fiber->resume($value);
138-
139-
// The last call to "resume()" moves the execution of the
140-
// Fiber to the "return" stmt.
141-
//
142-
// So the "yield" is not needed. Skip this step and return
143-
// the result.
144-
if ($fiber->isTerminated()) {
145-
break;
146-
}
147-
148-
$value = yield $value;
139+
/** @phpstan-ignore booleanNot.alwaysTrue */
140+
while (!$fiber->isTerminated()) {
141+
/** @phpstan-ignore argument.type */
142+
$value = $fiber->resume($value);
143+
144+
// The last call to "resume()" moves the execution of the
145+
// Fiber to the "return" stmt.
146+
//
147+
// So the "yield" is not needed. Skip this step and return
148+
// the result.
149+
/** @phpstan-ignore if.alwaysFalse */
150+
if ($fiber->isTerminated()) {
151+
break;
149152
}
153+
154+
/** @phpstan-ignore generator.valueType */
155+
$value = yield $value;
150156
}
151157

158+
/** @phpstan-ignore deadCode.unreachable */
152159
return $fiber->getReturn();
153160
}
154161
}

src/Workflow/Task/AssemblyTargetTask.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
*/
2222
public string $targetPathname;
2323

24+
/**
25+
* @param non-empty-string $sfxPathname
26+
* @param non-empty-string $targetPathname
27+
*/
2428
public function __construct(
2529
string $sfxPathname,
2630
string $targetPathname,

0 commit comments

Comments
 (0)