forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyserWithCheckDynamicPropertiesTest.php
More file actions
51 lines (42 loc) · 1.08 KB
/
Copy pathAnalyserWithCheckDynamicPropertiesTest.php
File metadata and controls
51 lines (42 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php declare(strict_types = 1);
namespace PHPStan\Analyser;
use PHPStan\Testing\PHPStanTestCase;
use function array_merge;
use function array_unique;
class AnalyserWithCheckDynamicPropertiesTest extends PHPStanTestCase
{
public function testBug13529(): void
{
$errors = $this->runAnalyse(__DIR__ . '/data/bug-13529.php');
$this->assertCount(0, $errors);
}
/**
* @return list<Error>
*/
private function runAnalyse(string $file): array
{
$file = $this->getFileHelper()->normalizePath($file);
$analyser = self::getContainer()->getByType(Analyser::class);
$finalizer = self::getContainer()->getByType(AnalyserResultFinalizer::class);
$errors = $finalizer->finalize(
$analyser->analyse([$file], null, null, true),
false,
true,
)->getErrors();
foreach ($errors as $error) {
$this->assertSame($file, $error->getFilePath());
}
return $errors;
}
public static function getAdditionalConfigFiles(): array
{
return array_unique(
array_merge(
parent::getAdditionalConfigFiles(),
[
__DIR__ . '/checkDynamicProperties.neon',
],
),
);
}
}