-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathImpossibleCheckTypeMethodCallRuleTest.php
54 lines (47 loc) · 1.85 KB
/
ImpossibleCheckTypeMethodCallRuleTest.php
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
52
53
54
<?php declare(strict_types = 1);
namespace PHPStan\Type\BeberleiAssert;
use PHPStan\Rules\Comparison\ImpossibleCheckTypeMethodCallRule;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
/**
* @extends RuleTestCase<ImpossibleCheckTypeMethodCallRule>
*/
class ImpossibleCheckTypeMethodCallRuleTest extends RuleTestCase
{
protected function getRule(): Rule
{
return self::getContainer()->getByType(ImpossibleCheckTypeMethodCallRule::class);
}
public function testExtension(): void
{
$this->analyse([__DIR__ . '/data/impossible-check.php'], [
[
'Call to method Assert\AssertionChain::string() will always evaluate to true.',
12,
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
],
[
'Call to method Assert\AssertionChain::string() will always evaluate to true.',
16,
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
],
[
'Call to method Assert\AssertionChain::isJsonString() will always evaluate to true.',
22,
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
],
[
'Call to method Assert\AssertionChain::isJsonString() will always evaluate to true.',
25,
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
],
]);
}
public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/../../../extension.neon',
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
];
}
}