Skip to content

Commit 8f3d079

Browse files
committed
[BUGFIX] Fix phpstan annotations and migrate away from Prophecy
1 parent bfada6d commit 8f3d079

File tree

83 files changed

+868
-91
lines changed

Some content is hidden

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

83 files changed

+868
-91
lines changed

phpstan-baseline.neon

Lines changed: 403 additions & 0 deletions
Large diffs are not rendered by default.

phpstan.neon

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
2-
level: 8
3-
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
4-
paths:
5-
- src
6-
- tests
5+
level: 8
6+
parallel:
7+
# to prevent full thread lagging pc
8+
maximumNumberOfProcesses: 7
9+
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
10+
paths:
11+
- src
12+
- tests
713

8-
inferPrivatePropertyTypeFromConstructor: true
9-
checkMissingIterableValueType: false
10-
checkGenericClassInNonGenericObjectType: false
14+
inferPrivatePropertyTypeFromConstructor: true
15+
treatPhpDocTypesAsCertain: false

src/Application/BaseApplication.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ class BaseApplication extends Application
3939
* Symlinks, which should be created for each release.
4040
*
4141
* @see \TYPO3\Surf\Task\Generic\CreateSymlinksTask
42+
* @var string[]
4243
*/
4344
protected array $symlinks = [];
4445

4546
/**
4647
* Directories which should be created on deployment. E.g. shared folders.
48+
*
49+
* @var string[]
4750
*/
4851
protected array $directories = [];
4952

@@ -125,13 +128,19 @@ public function registerTasks(Workflow $workflow, Deployment $deployment): void
125128
}
126129
}
127130

131+
/**
132+
* @param string[] $symlinks
133+
*/
128134
public function setSymlinks(array $symlinks): self
129135
{
130136
$this->symlinks = $symlinks;
131137

132138
return $this;
133139
}
134140

141+
/**
142+
* @return string[]
143+
*/
135144
public function getSymlinks(): array
136145
{
137146
return $this->symlinks;
@@ -144,6 +153,9 @@ public function addSymlink(string $linkPath, string $sourcePath): self
144153
return $this;
145154
}
146155

156+
/**
157+
* @param string[] $symlinks
158+
*/
147159
public function addSymlinks(array $symlinks): self
148160
{
149161
foreach ($symlinks as $linkPath => $sourcePath) {
@@ -153,13 +165,19 @@ public function addSymlinks(array $symlinks): self
153165
return $this;
154166
}
155167

168+
/**
169+
* @param string[] $directories
170+
*/
156171
public function setDirectories(array $directories): self
157172
{
158173
$this->directories = $directories;
159174

160175
return $this;
161176
}
162177

178+
/**
179+
* @return string[]
180+
*/
163181
public function getDirectories(): array
164182
{
165183
return $this->directories;
@@ -172,6 +190,9 @@ public function addDirectory(string $path): self
172190
return $this;
173191
}
174192

193+
/**
194+
* @param string[] $directories
195+
*/
175196
public function addDirectories(array $directories): self
176197
{
177198
foreach ($directories as $path) {

src/Application/Neos/Flow.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ public function getCommandPackageKey(string $command = ''): string
130130
}
131131

132132
/**
133-
* Returns a executable flow command including the context
133+
* Returns an executable flow command including the context
134+
*
135+
* @param string[] $arguments
134136
*/
135137
public function buildCommand(
136138
string $targetPath,

src/Application/Neos/Neos.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
class Neos extends Flow
1515
{
16+
/**
17+
* @var string[]
18+
*/
1619
private array $neosCommands = [
1720
'domain:add',
1821
'domain:list',

src/Cli/Symfony/Logger/ConsoleHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ class ConsoleHandler extends AbstractProcessingHandler
3333
{
3434
private OutputInterface $output;
3535

36+
/**
37+
* @var array<int, mixed>
38+
*/
3639
private array $verbosityLevelMap = [
3740
OutputInterface::VERBOSITY_NORMAL => Logger::INFO,
3841
OutputInterface::VERBOSITY_VERBOSE => Logger::DEBUG,
3942
OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::DEBUG,
4043
OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG,
4144
];
4245

46+
/**
47+
* @param array<int, array<int, mixed>> $verbosityLevelMap
48+
*/
4349
public function __construct(OutputInterface $output, bool $bubble = true, array $verbosityLevelMap = [])
4450
{
4551
parent::__construct(Logger::DEBUG, $bubble);

src/Command/DescribeCommand.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Console\Output\OutputInterface;
1919
use TYPO3\Surf\Domain\Model\Application;
2020
use TYPO3\Surf\Domain\Model\FailedDeployment;
21+
use TYPO3\Surf\Domain\Model\Node;
2122
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
2223
use TYPO3\Surf\Domain\Model\Workflow;
2324
use TYPO3\Surf\Integration\FactoryInterface;
@@ -91,6 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9192
return Command::SUCCESS;
9293
}
9394

95+
/**
96+
* @param Node[] $nodes
97+
*/
9498
protected function printNodes(array $nodes): void
9599
{
96100
$this->output->writeln('Nodes:' . PHP_EOL);
@@ -99,6 +103,9 @@ protected function printNodes(array $nodes): void
99103
}
100104
}
101105

106+
/**
107+
* @param Application[] $applications
108+
*/
102109
protected function printApplications(array $applications, Workflow $workflow): void
103110
{
104111
$this->output->writeln(PHP_EOL . 'Applications:' . PHP_EOL);
@@ -127,6 +134,10 @@ protected function printApplications(array $applications, Workflow $workflow): v
127134
}
128135
}
129136

137+
/**
138+
* @param array<string, mixed> $stages
139+
* @param array<string, mixed> $tasks
140+
*/
130141
protected function printStages(Application $application, array $stages, array $tasks): void
131142
{
132143
foreach ($stages as $stage) {
@@ -155,6 +166,7 @@ protected function printStages(Application $application, array $stages, array $t
155166
/**
156167
* Print all tasks before or after a task
157168
*
169+
* @param array<string, mixed> $tasks
158170
* @param string $output
159171
*/
160172
private function printBeforeAfterTasks(array $tasks, string $applicationName, string $task, string $step, &$output): void

src/Domain/Filesystem/Filesystem.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public function createDirectory(string $directory): bool
6565
return mkdir($directory, 0777, true);
6666
}
6767

68+
/**
69+
* @return string[]
70+
*/
6871
public function glob(string $pattern): array
6972
{
7073
$matches = glob($pattern);

src/Domain/Filesystem/FilesystemInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@ public function fileExists(string $file): bool;
3535

3636
public function createDirectory(string $directory): bool;
3737

38+
/**
39+
* @return string[]
40+
*/
3841
public function glob(string $pattern): array;
3942
}

src/Domain/Model/Application.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class Application
4848
*/
4949
protected string $releasesDirectory = 'releases';
5050

51+
/**
52+
* @var array<string,mixed>
53+
*/
5154
protected array $options = [];
5255

5356
public function __construct(string $name)
@@ -219,6 +222,8 @@ public function getReleasesPath(): string
219222
*
220223
* The options will include the deploymentPath and sharedPath for
221224
* unified option handling.
225+
*
226+
* @return array<string,mixed>
222227
*/
223228
public function getOptions(): array
224229
{
@@ -267,6 +272,9 @@ public function provideStringOption(string $key): string
267272
return (string)$this->getOption($key);
268273
}
269274

275+
/**
276+
* @param array<string, mixed> $options
277+
*/
270278
public function setOptions(array $options): self
271279
{
272280
$this->options = $options;

0 commit comments

Comments
 (0)