Skip to content

Commit eb4b487

Browse files
committedOct 30, 2018
Fixed build
1 parent 929440a commit eb4b487

File tree

3 files changed

+19
-164
lines changed

3 files changed

+19
-164
lines changed
 

‎tests/Symfony/ExampleContainer.php

-154
This file was deleted.

‎tests/Symfony/NeonTest.php

+14-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,24 @@ public function testExtensionNeon(): void
2222
@unlink($generatedContainer);
2323
self::assertFileNotExists($generatedContainer);
2424

25-
$loader->load(function (Compiler $compiler): void {
25+
$class = $loader->load(function (Compiler $compiler): void {
2626
$compiler->addExtension('rules', new RulesExtension());
2727
$compiler->loadConfig(__DIR__ . '/config.neon');
2828
$compiler->loadConfig(__DIR__ . '/../../extension.neon');
2929
}, $key);
30-
31-
self::assertFileEquals(__DIR__ . '/ExampleContainer.php', $generatedContainer);
30+
/** @var \Nette\DI\Container $container */
31+
$container = new $class();
32+
33+
self::assertSame([
34+
'symfony' => [
35+
'container_xml_path' => '',
36+
'constant_hassers' => true,
37+
],
38+
], $container->getParameters());
39+
40+
self::assertCount(2, $container->findByTag('phpstan.rules.rule'));
41+
self::assertCount(4, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension'));
42+
self::assertCount(3, $container->findByTag('phpstan.typeSpecifier.methodTypeSpecifyingExtension'));
3243
}
3344

3445
}

‎tests/Type/Symfony/ExtensionTestCase.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
use PHPStan\Broker\AnonymousClassNameHelper;
1111
use PHPStan\Cache\Cache;
1212
use PHPStan\File\FileHelper;
13-
use PHPStan\File\RelativePathHelper;
1413
use PHPStan\PhpDoc\PhpDocStringResolver;
1514
use PHPStan\PhpDoc\TypeNodeResolver;
1615
use PHPStan\Testing\TestCase;
1716
use PHPStan\Type\DynamicMethodReturnTypeExtension;
1817
use PHPStan\Type\FileTypeMapper;
1918
use PHPStan\Type\VerbosityLevel;
20-
use const DIRECTORY_SEPARATOR;
2119

2220
abstract class ExtensionTestCase extends TestCase
2321
{
@@ -41,13 +39,13 @@ protected function processFile(
4139
$resolver = new NodeScopeResolver(
4240
$broker,
4341
$parser,
44-
new FileTypeMapper(
42+
new FileTypeMapper(...[ // PHPStan commit 7b23c31 broke the constructor so we have to use splat here
4543
$parser,
4644
$phpDocStringResolver,
4745
$this->createMock(Cache::class),
48-
new AnonymousClassNameHelper($fileHelper, new RelativePathHelper($currentWorkingDirectory, DIRECTORY_SEPARATOR, [])),
49-
$typeNodeResolver
50-
),
46+
$this->createMock(AnonymousClassNameHelper::class), // PHPStan commit 4fcdccc broke the helper so we have to use a mock here
47+
$typeNodeResolver,
48+
]),
5149
$fileHelper,
5250
$typeSpecifier,
5351
true,
@@ -66,7 +64,7 @@ function (Node $node, Scope $scope) use ($expression, $type, &$run): void {
6664
}
6765
/** @var \PhpParser\Node\Stmt\Expression $expNode */
6866
$expNode = $this->getParser()->parseString(sprintf('<?php %s;', $expression))[0];
69-
self::assertSame($type, $scope->getType($expNode->expr)->describe(VerbosityLevel::precise()));
67+
self::assertSame($type, $scope->getType($expNode->expr)->describe(VerbosityLevel::typeOnly()));
7068
$run = true;
7169
}
7270
);

0 commit comments

Comments
 (0)
Please sign in to comment.