Skip to content

Commit 7182e39

Browse files
committed
Add phpstan-strict-rules
1 parent 9e4f092 commit 7182e39

11 files changed

+70
-13
lines changed

.circleci/config.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ jobs:
1010
- restore_cache:
1111
key: vendor-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
1212
- run:
13-
composer install --ignore-platform-reqs --no-interaction
13+
name: Install Composer dependencies
14+
command:
15+
composer install --ignore-platform-reqs --no-interaction
1416
- save_cache:
1517
key: vendor-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
16-
paths:
17-
- ./vendor
18-
- persist_to_workspace:
19-
root: .
2018
paths:
2119
- vendor
2220

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"require-dev": {
3535
"phpstan/phpstan": "0.12.*",
36+
"phpstan/phpstan-strict-rules": "^0.12.2",
3637
"phpstan/phpstan-symfony": "0.12.*",
3738
"steevanb/php-backtrace": "2.0.*",
3839
"symfony/var-dumper": "4.4.*"

composer.lock

Lines changed: 54 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ parameters:
77
container_xml_path: /app/var/cache/dev/srcApp_KernelDevDebugContainer.xml
88
excludes_analyse:
99
- src/Version.php
10+
ignoreErrors:
11+
- '#Variable static method call on App\\Benchmark\\Benchmark.#'
1012
includes:
1113
- /app/vendor/phpstan/phpstan-symfony/extension.neon
14+
- /app/vendor/phpstan/phpstan-strict-rules/rules.neon

src/Command/AbstractCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ protected function doRunProcess(
271271
string $silencedError = null
272272
): self {
273273
$processResult = $process->run(
274-
function (string $type, string $line) use ($outputVerbosity) {
274+
function (string $type, string $line) use ($outputVerbosity): void {
275275
if ($this->getOutput()->getVerbosity() >= $outputVerbosity) {
276276
$this->getOutput()->writeln($line);
277277
}

src/Command/Configure/ConfigurePhpBenchmarksCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private function getCoreDependency(string $componentSlug): array
181181

182182
$name = $this->getInput()->getOption('core-dependency-name');
183183
if (is_string($name) === true) {
184-
if (in_array($name, $choices) === false) {
184+
if (in_array($name, $choices, true) === false) {
185185
throw new \Exception("Core dependency name $name not found in composer.json.");
186186
}
187187
} else {

src/Command/Validate/Benchmark/ValidateBenchmarkPhpInfoCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function afterHttpCodeValidated(
3434
PhpVersion $phpVersion,
3535
BenchmarkConfiguration $benchmarkConfiguration,
3636
?string $body
37-
): self {
37+
): parent {
3838
if (is_string($body) === false || strlen($body) === 0) {
3939
throw new \Exception('phpinfo() should not output an empty string.');
4040
}

src/Command/Validate/Benchmark/ValidateBenchmarkResponseCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function afterHttpCodeValidated(
3737
PhpVersion $phpVersion,
3838
BenchmarkConfiguration $benchmarkConfiguration,
3939
?string $body
40-
): self {
40+
): parent {
4141
$validated = false;
4242
$responseBodyPath = Path::getResponseBodyPath($phpVersion);
4343

src/Command/Validate/Benchmark/ValidateBenchmarkStatisticsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function afterHttpCodeValidated(
4040
PhpVersion $phpVersion,
4141
BenchmarkConfiguration $benchmarkConfiguration,
4242
?string $body
43-
): self {
43+
): parent {
4444
// Wait for statistics.json file to be written, sometimes it's not the case at this stage
4545
sleep(1);
4646

src/Command/Validate/Configuration/ValidateConfigurationSourceCodeUrlsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function assertCodeSourceUrls(): self
7171

7272
$urls = Benchmark::getSourceCodeUrls();
7373
foreach ($urls as $id => $url) {
74-
if (in_array($id, $expectedUrlIds) === false) {
74+
if (in_array($id, $expectedUrlIds, true) === false) {
7575
throw new \Exception('Configuration sourceCode.urls contains an unknown key "' . $id . '".');
7676
}
7777

0 commit comments

Comments
 (0)