Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fcaef71

Browse files
Forward compatibility - define parameters schema
1 parent 2ce274c commit fcaef71

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

‎composer.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
"require": {
2626
"php": "^7.1",
2727
"ext-simplexml": "*",
28-
"phpstan/phpstan": "^0.11.4",
28+
"phpstan/phpstan": "^0.11.7",
2929
"nikic/php-parser": "^4.0"
3030
},
3131
"require-dev": {
3232
"consistence/coding-standard": "^3.0.1",
3333
"jakub-onderka/php-parallel-lint": "^1.0",
3434
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
35+
"nette/di": "^3.0-stable",
3536
"phpunit/phpunit": "^7.0",
3637
"phing/phing": "^2.16.0",
3738
"phpstan/phpstan-strict-rules": "^0.11",

‎extension.neon‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ parameters:
44
constant_hassers: true
55
console_application_loader: null
66

7+
parametersSchema:
8+
symfony: structure([
9+
container_xml_path: schema(string(), nullable())
10+
constant_hassers: bool()
11+
console_application_loader: schema(string(), nullable())
12+
])
13+
714
rules:
815
- PHPStan\Rules\Symfony\ContainerInterfacePrivateServiceRule
916
- PHPStan\Rules\Symfony\ContainerInterfaceUnknownServiceRule

‎tests/Symfony/NeonTest.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Nette\DI\Compiler;
66
use Nette\DI\ContainerLoader;
7+
use PHPStan\DependencyInjection\ParametersSchemaExtension;
78
use PHPStan\DependencyInjection\RulesExtension;
89
use PHPUnit\Framework\TestCase;
910
use function sprintf;
@@ -24,21 +25,25 @@ public function testExtensionNeon(): void
2425

2526
$class = $loader->load(function (Compiler $compiler): void {
2627
$compiler->addExtension('rules', new RulesExtension());
28+
$compiler->addExtension('parametersSchema', new ParametersSchemaExtension());
2729
$compiler->addConfig(['parameters' => ['rootDir' => __DIR__]]);
2830
$compiler->loadConfig(__DIR__ . '/../../extension.neon');
2931
$compiler->loadConfig(__DIR__ . '/config.neon');
3032
}, $key);
3133
/** @var \Nette\DI\Container $container */
3234
$container = new $class();
3335

36+
$parameters = $container->getParameters();
37+
unset($parameters['__parametersSchema']);
38+
3439
self::assertSame([
3540
'rootDir' => __DIR__,
3641
'symfony' => [
3742
'container_xml_path' => __DIR__ . '/container.xml',
3843
'constant_hassers' => true,
3944
'console_application_loader' => null,
4045
],
41-
], $container->getParameters());
46+
], $parameters);
4247

4348
self::assertCount(6, $container->findByTag('phpstan.rules.rule'));
4449
self::assertCount(11, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension'));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /