Skip to content

Commit eab9ef2

Browse files
committed
Isolate phpstan.drop.in from rest of the coding-standard application
1 parent c9c669c commit eab9ef2

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

config/phpstan/isolation.layer.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Zooroyal\CodingStandard\CommandLine\ApplicationLifeCycle\ContainerFactory;
6+
use Zooroyal\CodingStandard\CommandLine\StaticCodeAnalysis\PHPStan\PHPStanConfigGenerator;
7+
8+
$autoloadFiles = [
9+
__DIR__ . '/../../../../autoload.php',
10+
__DIR__ . '/../../vendor/autoload.php',
11+
];
12+
13+
foreach ($autoloadFiles as $autoloadFile) {
14+
if (file_exists($autoloadFile)) {
15+
require_once $autoloadFile;
16+
break;
17+
}
18+
}
19+
$config = ContainerFactory::getContainerInstance()
20+
->get(PHPStanConfigGenerator::class)
21+
->addDynamicConfigValues([]);
22+
23+
echo json_encode($config, JSON_THROW_ON_ERROR, 512);
24+
25+

config/phpstan/phpstan.config.drop.in.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use Zooroyal\CodingStandard\CommandLine\ApplicationLifeCycle\ContainerFactory;
6-
use Zooroyal\CodingStandard\CommandLine\StaticCodeAnalysis\PHPStan\PHPStanConfigGenerator;
5+
exec('php ' . __DIR__ . '/isolation.layer.php', $output);
76

8-
$autoloadFiles = [
9-
__DIR__ . '/../../../../autoload.php',
10-
__DIR__ . '/../../vendor/autoload.php',
11-
];
12-
13-
foreach ($autoloadFiles as $autoloadFile) {
14-
if (file_exists($autoloadFile)) {
15-
require_once $autoloadFile;
16-
break;
17-
}
18-
}
19-
$config = ContainerFactory::getContainerInstance()
20-
->get(PHPStanConfigGenerator::class)
21-
->addDynamicConfigValues([]);
22-
23-
echo 'Coding-Standard config loaded!' . PHP_EOL;
7+
$config = json_decode($output[0], true, 512, JSON_THROW_ON_ERROR);
248

259
return $config;

0 commit comments

Comments
 (0)