Skip to content

Commit 2f55648

Browse files
committed
phpstan level 5
1 parent 90a42fc commit 2f55648

File tree

8 files changed

+16
-8
lines changed

8 files changed

+16
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@
5656
"phpcs src --standard=PSR12 --encoding=UTF-8",
5757
"phpcs test --standard=PSR12 --encoding=UTF-8"
5858
],
59-
"static": "phpstan --ansi analyse --level 3 src"
59+
"static": "phpstan --ansi analyse --level 5 src"
6060
}
6161
}

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
treatPhpDocTypesAsCertain: false

src/CommandRouter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private function resolveCallable(CommandDefinition $command, Input $input)
219219
* @param CommandDefinition $command
220220
* @param callable $callable
221221
* @param Input $input
222-
* @return int
222+
* @return ?int
223223
*/
224224
private function callCommand(CommandDefinition $command, callable $callable, Input $input)
225225
{

src/ExerciseRunner/CgiRunner.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use PhpSchool\PhpWorkshop\Exception\CodeExecutionException;
1313
use PhpSchool\PhpWorkshop\Exception\SolutionExecutionException;
1414
use PhpSchool\PhpWorkshop\Exercise\CgiExercise;
15+
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
1516
use PhpSchool\PhpWorkshop\Input\Input;
1617
use PhpSchool\PhpWorkshop\Output\OutputInterface;
1718
use PhpSchool\PhpWorkshop\Result\Cgi\CgiResult;
@@ -32,9 +33,8 @@
3233
*/
3334
class CgiRunner implements ExerciseRunnerInterface
3435
{
35-
3636
/**
37-
* @var CgiExercise
37+
* @var CgiExercise&ExerciseInterface
3838
*/
3939
private $exercise;
4040

@@ -93,6 +93,7 @@ public function __construct(
9393
);
9494
}
9595
}
96+
/** @var CgiExercise&ExerciseInterface $exercise */
9697
$this->eventDispatcher = $eventDispatcher;
9798
$this->exercise = $exercise;
9899
$this->requestRenderer = $requestRenderer;

src/ExerciseRunner/CliRunner.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use PhpSchool\PhpWorkshop\Exception\CodeExecutionException;
1313
use PhpSchool\PhpWorkshop\Exception\SolutionExecutionException;
1414
use PhpSchool\PhpWorkshop\Exercise\CliExercise;
15+
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
1516
use PhpSchool\PhpWorkshop\Input\Input;
1617
use PhpSchool\PhpWorkshop\Output\OutputInterface;
1718
use PhpSchool\PhpWorkshop\Result\Cli\RequestFailure;
@@ -33,7 +34,7 @@
3334
class CliRunner implements ExerciseRunnerInterface
3435
{
3536
/**
36-
* @var CliExercise
37+
* @var CliExercise&ExerciseInterface
3738
*/
3839
private $exercise;
3940

@@ -59,6 +60,7 @@ class CliRunner implements ExerciseRunnerInterface
5960
*/
6061
public function __construct(CliExercise $exercise, EventDispatcher $eventDispatcher)
6162
{
63+
/** @var CliExercise&ExerciseInterface $exercise */
6264
$this->eventDispatcher = $eventDispatcher;
6365
$this->exercise = $exercise;
6466
}

src/ExerciseRunner/Factory/CgiRunnerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpSchool\PhpWorkshop\CommandArgument;
66
use PhpSchool\PhpWorkshop\CommandDefinition;
77
use PhpSchool\PhpWorkshop\Event\EventDispatcher;
8+
use PhpSchool\PhpWorkshop\Exercise\CgiExercise;
89
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
910
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
1011
use PhpSchool\PhpWorkshop\ExerciseRunner\CgiRunner;
@@ -64,7 +65,7 @@ public function configureInput(CommandDefinition $commandDefinition)
6465
/**
6566
* Create and return an instance of the runner.
6667
*
67-
* @param ExerciseInterface $exercise
68+
* @param ExerciseInterface&CgiExercise $exercise
6869
* @return ExerciseRunnerInterface
6970
*/
7071
public function create(ExerciseInterface $exercise)

src/ExerciseRunner/Factory/CliRunnerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpSchool\PhpWorkshop\CommandArgument;
66
use PhpSchool\PhpWorkshop\CommandDefinition;
77
use PhpSchool\PhpWorkshop\Event\EventDispatcher;
8+
use PhpSchool\PhpWorkshop\Exercise\CliExercise;
89
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
910
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
1011
use PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner;
@@ -57,7 +58,7 @@ public function configureInput(CommandDefinition $commandDefinition)
5758
/**
5859
* Create and return an instance of the runner.
5960
*
60-
* @param ExerciseInterface $exercise
61+
* @param ExerciseInterface&CliExercise $exercise
6162
* @return ExerciseRunnerInterface
6263
*/
6364
public function create(ExerciseInterface $exercise)

src/ExerciseRunner/Factory/CustomVerifyingRunnerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PhpSchool\PhpWorkshop\ExerciseRunner\Factory;
44

55
use PhpSchool\PhpWorkshop\CommandDefinition;
6+
use PhpSchool\PhpWorkshop\Exercise\CustomVerifyingExercise;
67
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
78
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
89
use PhpSchool\PhpWorkshop\ExerciseRunner\CustomVerifyingRunner;
@@ -41,7 +42,7 @@ public function configureInput(CommandDefinition $commandDefinition)
4142
/**
4243
* Create and return an instance of the runner.
4344
*
44-
* @param ExerciseInterface $exercise
45+
* @param ExerciseInterface&CustomVerifyingExercise $exercise
4546
* @return ExerciseRunnerInterface
4647
*/
4748
public function create(ExerciseInterface $exercise)

0 commit comments

Comments
 (0)