Skip to content

Commit

Permalink
Fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
lookyman committed Oct 30, 2018
1 parent 929440a commit eb4b487
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 164 deletions.
154 changes: 0 additions & 154 deletions tests/Symfony/ExampleContainer.php

This file was deleted.

17 changes: 14 additions & 3 deletions tests/Symfony/NeonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@ public function testExtensionNeon(): void
@unlink($generatedContainer);
self::assertFileNotExists($generatedContainer);

$loader->load(function (Compiler $compiler): void {
$class = $loader->load(function (Compiler $compiler): void {
$compiler->addExtension('rules', new RulesExtension());
$compiler->loadConfig(__DIR__ . '/config.neon');
$compiler->loadConfig(__DIR__ . '/../../extension.neon');
}, $key);

self::assertFileEquals(__DIR__ . '/ExampleContainer.php', $generatedContainer);
/** @var \Nette\DI\Container $container */
$container = new $class();

self::assertSame([
'symfony' => [
'container_xml_path' => '',
'constant_hassers' => true,
],
], $container->getParameters());

self::assertCount(2, $container->findByTag('phpstan.rules.rule'));
self::assertCount(4, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension'));
self::assertCount(3, $container->findByTag('phpstan.typeSpecifier.methodTypeSpecifyingExtension'));
}

}
12 changes: 5 additions & 7 deletions tests/Type/Symfony/ExtensionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
use PHPStan\Broker\AnonymousClassNameHelper;
use PHPStan\Cache\Cache;
use PHPStan\File\FileHelper;
use PHPStan\File\RelativePathHelper;
use PHPStan\PhpDoc\PhpDocStringResolver;
use PHPStan\PhpDoc\TypeNodeResolver;
use PHPStan\Testing\TestCase;
use PHPStan\Type\DynamicMethodReturnTypeExtension;
use PHPStan\Type\FileTypeMapper;
use PHPStan\Type\VerbosityLevel;
use const DIRECTORY_SEPARATOR;

abstract class ExtensionTestCase extends TestCase
{
Expand All @@ -41,13 +39,13 @@ protected function processFile(
$resolver = new NodeScopeResolver(
$broker,
$parser,
new FileTypeMapper(
new FileTypeMapper(...[ // PHPStan commit 7b23c31 broke the constructor so we have to use splat here
$parser,
$phpDocStringResolver,
$this->createMock(Cache::class),
new AnonymousClassNameHelper($fileHelper, new RelativePathHelper($currentWorkingDirectory, DIRECTORY_SEPARATOR, [])),
$typeNodeResolver
),
$this->createMock(AnonymousClassNameHelper::class), // PHPStan commit 4fcdccc broke the helper so we have to use a mock here
$typeNodeResolver,
]),
$fileHelper,
$typeSpecifier,
true,
Expand All @@ -66,7 +64,7 @@ function (Node $node, Scope $scope) use ($expression, $type, &$run): void {
}
/** @var \PhpParser\Node\Stmt\Expression $expNode */
$expNode = $this->getParser()->parseString(sprintf('<?php %s;', $expression))[0];
self::assertSame($type, $scope->getType($expNode->expr)->describe(VerbosityLevel::precise()));
self::assertSame($type, $scope->getType($expNode->expr)->describe(VerbosityLevel::typeOnly()));
$run = true;
}
);
Expand Down

0 comments on commit eb4b487

Please sign in to comment.