Skip to content

Commit b5fd96f

Browse files
committed
Add conditional phpstan baseline
1 parent b2b27c5 commit b5fd96f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"php-parallel-lint/php-parallel-lint": "^1.3.2",
3535
"squizlabs/php_codesniffer": "^4.0.1",
3636
"slevomat/coding-standard": "^8.25.0",
37-
"nette/neon": ">=3.3.4"
37+
"nette/neon": ">=3.3.4",
38+
"composer-runtime-api": "^2.0",
39+
"composer/semver": "3.4.4"
3840
},
3941
"autoload": {
4042
"psr-0": {

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ includes:
1313
- vendor/phpstan/phpstan-nette/extension.neon
1414
- vendor/phpstan/phpstan-nette/rules.neon
1515
- phpstan-baseline.neon
16+
- tests/PHPStan/conditional.config.php
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use Composer\InstalledVersions;
5+
use Composer\Semver\VersionParser;
6+
7+
$config = ['parameters' => ['ignoreErrors' => []]];
8+
9+
if (InstalledVersions::satisfies(new VersionParser(), 'nette/application', '<3.2')) {
10+
$config['parameters']['ignoreErrors'][] = [
11+
'message' => '~^Call to function method_exists\\(\\) with Nette\\\\Application\\\\UI\\\\Presenter and \'getContext\' will always evaluate to true\\.$~',
12+
'path' => __DIR__ . '/../../src/Kdyby/Autowired/AutowireComponentFactories.php',
13+
'count' => 6,
14+
];
15+
}
16+
17+
return $config;

0 commit comments

Comments
 (0)