Skip to content

Commit b4783b6

Browse files
authored
Let PHPStan check array and iterable types & generics (#27)
1 parent 342bc34 commit b4783b6

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/CommandRunner.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,15 @@ public function __construct(string $binDir, string $logDir, PhpExecutableFinder
3535
}
3636

3737
/**
38-
* @param string $commandName
39-
* @param array $arguments
38+
* @phpstan-param array<string, mixed> $arguments
4039
*/
4140
public function run(string $commandName, array $arguments = []): void
4241
{
4342
$this->exec($this->buildCommand($commandName, $arguments));
4443
}
4544

4645
/**
47-
* @param string $commandName
48-
* @param string $logFilename
49-
* @param array $arguments
46+
* @phpstan-param array<string, mixed> $arguments
5047
*/
5148
public function runAsync(string $commandName, string $logFilename, array $arguments = []): void
5249
{
@@ -64,6 +61,9 @@ protected function exec(string $command): void
6461
exec($command);
6562
}
6663

64+
/**
65+
* @phpstan-param array<string, mixed> $arguments
66+
*/
6767
private function buildCommand(string $commandName, array $arguments): string
6868
{
6969
return sprintf(

src/RunJobCommand.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
final class RunJobCommand extends Command
1717
{
18+
protected static $defaultName = 'yokai:batch:run';
19+
1820
public const EXIT_SUCCESS_CODE = 0;
1921
public const EXIT_ERROR_CODE = 1;
2022
public const EXIT_WARNING_CODE = 2;
@@ -29,7 +31,7 @@ final class RunJobCommand extends Command
2931
*/
3032
public function __construct(JobLauncherInterface $jobLauncher)
3133
{
32-
parent::__construct(null);
34+
parent::__construct();
3335
$this->jobLauncher = $jobLauncher;
3436
}
3537

@@ -38,10 +40,8 @@ public function __construct(JobLauncherInterface $jobLauncher)
3840
*/
3941
protected function configure(): void
4042
{
41-
$this
42-
->setName('yokai:batch:run')
43-
->addArgument('job', InputArgument::REQUIRED)
44-
->addArgument('configuration', InputArgument::OPTIONAL);
43+
$this->addArgument('job', InputArgument::REQUIRED);
44+
$this->addArgument('configuration', InputArgument::OPTIONAL);
4545
}
4646

4747
/**
@@ -118,6 +118,8 @@ private function outputExecution(JobExecution $jobExecution, OutputInterface $ou
118118
*
119119
* @throws InvalidArgumentException
120120
* @return array
121+
*
122+
* @phpstan-return array<string, mixed>
121123
*/
122124
private function decodeConfiguration(string $data): array
123125
{

0 commit comments

Comments
 (0)