Skip to content

Commit bbd9849

Browse files
authored
Merge pull request #179 from php-school/more-type-coverage
More type coverage
2 parents 46760f2 + 44da484 commit bbd9849

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+147
-142
lines changed

src/Check/ComposerCheck.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
class ComposerCheck implements SimpleCheckInterface
1919
{
20-
2120
/**
2221
* Return the check's name
2322
*/

src/Check/DatabaseCheck.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class DatabaseCheck implements ListenableCheckInterface
5151
*/
5252
public function __construct()
5353
{
54-
$this->databaseDirectory = $this->getTemporaryPath();
55-
$this->userDatabasePath = sprintf('%s/user-db.sqlite', $this->databaseDirectory);
54+
$this->databaseDirectory = $this->getTemporaryPath();
55+
$this->userDatabasePath = sprintf('%s/user-db.sqlite', $this->databaseDirectory);
5656
$this->solutionDatabasePath = sprintf('%s/solution-db.sqlite', $this->databaseDirectory);
57-
$this->solutionDsn = sprintf('sqlite:%s', $this->solutionDatabasePath);
58-
$this->userDsn = sprintf('sqlite:%s', $this->userDatabasePath);
57+
$this->solutionDsn = sprintf('sqlite:%s', $this->solutionDatabasePath);
58+
$this->userDsn = sprintf('sqlite:%s', $this->userDatabasePath);
5959
}
6060

6161
/**

src/Check/FunctionRequirementsCheck.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525
class FunctionRequirementsCheck implements SimpleCheckInterface
2626
{
27-
2827
/**
2928
* @var Parser
3029
*/

src/Check/PhpLintCheck.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
class PhpLintCheck implements SimpleCheckInterface
1818
{
19-
2019
/**
2120
* Return the check's name
2221
*/

src/Command/HelpCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ class HelpCommand
3131
* @param OutputInterface $output
3232
* @param Color $color
3333
*/
34-
public function __construct($appName, OutputInterface $output, Color $color)
34+
public function __construct(string $appName, OutputInterface $output, Color $color)
3535
{
36-
$this->output = $output;
37-
$this->color = $color;
38-
$this->appName = $appName;
36+
$this->output = $output;
37+
$this->color = $color;
38+
$this->appName = $appName;
3939
}
4040

4141
/**
4242
* @return void
4343
*/
44-
public function __invoke()
44+
public function __invoke(): void
4545
{
4646
$this->output->writeLine($this->color->__invoke('Usage')->yellow()->bold());
4747
$this->output->writeLine("");

src/Command/MenuCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(CliMenu $menu)
2525
/**
2626
* @return void
2727
*/
28-
public function __invoke()
28+
public function __invoke(): void
2929
{
3030
$this->menu->open();
3131
}

src/Command/PrintCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ class PrintCommand
4646
* @param OutputInterface $output
4747
*/
4848
public function __construct(
49-
$appName,
49+
string $appName,
5050
ExerciseRepository $exerciseRepository,
5151
UserState $userState,
5252
MarkdownRenderer $markdownRenderer,
5353
OutputInterface $output
5454
) {
55-
$this->appName = $appName;
56-
$this->markdownRenderer = $markdownRenderer;
57-
$this->output = $output;
58-
$this->userState = $userState;
59-
$this->exerciseRepository = $exerciseRepository;
55+
$this->appName = $appName;
56+
$this->markdownRenderer = $markdownRenderer;
57+
$this->output = $output;
58+
$this->userState = $userState;
59+
$this->exerciseRepository = $exerciseRepository;
6060
}
6161

6262
/**
63-
* @return int|void
63+
* @return void
6464
*/
65-
public function __invoke()
65+
public function __invoke(): void
6666
{
6767
$currentExercise = $this->userState->getCurrentExercise();
6868
$exercise = $this->exerciseRepository->findByName($currentExercise);

src/Command/RunCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ public function __construct(
4545
UserState $userState,
4646
OutputInterface $output
4747
) {
48-
$this->output = $output;
49-
$this->exerciseRepository = $exerciseRepository;
50-
$this->userState = $userState;
51-
$this->exerciseDispatcher = $exerciseDispatcher;
48+
$this->output = $output;
49+
$this->exerciseRepository = $exerciseRepository;
50+
$this->userState = $userState;
51+
$this->exerciseDispatcher = $exerciseDispatcher;
5252
}
5353

5454
/**
5555
* @param Input $input The command line arguments passed to the command.
5656
*
57-
* @return int|void
57+
* @return void
5858
*/
59-
public function __invoke(Input $input)
59+
public function __invoke(Input $input): void
6060
{
6161
$exercise = $this->exerciseRepository->findByName($this->userState->getCurrentExercise());
6262
$this->exerciseDispatcher->run($exercise, $input, $this->output);

src/Command/VerifyCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ public function __construct(
6262
OutputInterface $output,
6363
ResultsRenderer $resultsRenderer
6464
) {
65-
$this->output = $output;
66-
$this->exerciseRepository = $exerciseRepository;
67-
$this->userState = $userState;
68-
$this->userStateSerializer = $userStateSerializer;
69-
$this->resultsRenderer = $resultsRenderer;
70-
$this->exerciseDispatcher = $exerciseDispatcher;
65+
$this->output = $output;
66+
$this->exerciseRepository = $exerciseRepository;
67+
$this->userState = $userState;
68+
$this->userStateSerializer = $userStateSerializer;
69+
$this->resultsRenderer = $resultsRenderer;
70+
$this->exerciseDispatcher = $exerciseDispatcher;
7171
}
7272

7373
/**
7474
* @param Input $input The command line arguments passed to the command.
7575
*
76-
* @return int|void
76+
* @return int
7777
*/
78-
public function __invoke(Input $input)
78+
public function __invoke(Input $input): int
7979
{
8080
$exercise = $this->exerciseRepository->findByName($this->userState->getCurrentExercise());
8181
$results = $this->exerciseDispatcher->verify($exercise, $input);

src/CommandArgument.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(string $name, bool $optional = false)
3131
* @param string $name
3232
* @return self
3333
*/
34-
public static function optional($name)
34+
public static function optional(string $name): self
3535
{
3636
return new self($name, true);
3737
}
@@ -40,31 +40,31 @@ public static function optional($name)
4040
* @param string $name
4141
* @return self
4242
*/
43-
public static function required($name)
43+
public static function required(string $name): self
4444
{
4545
return new self($name);
4646
}
4747

4848
/**
4949
* @return string
5050
*/
51-
public function getName()
51+
public function getName(): string
5252
{
5353
return $this->name;
5454
}
5555

5656
/**
5757
* @return bool
5858
*/
59-
public function isRequired()
59+
public function isRequired(): bool
6060
{
6161
return !$this->isOptional();
6262
}
6363

6464
/**
6565
* @return bool
6666
*/
67-
public function isOptional()
67+
public function isOptional(): bool
6868
{
6969
return $this->optional;
7070
}

0 commit comments

Comments
 (0)