forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiClassImplementsRuleTest.php
66 lines (58 loc) · 2.04 KB
/
ApiClassImplementsRuleTest.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
55
56
57
58
59
60
61
62
63
64
65
66
<?php declare(strict_types = 1);
namespace PHPStan\Rules\Api;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use function sprintf;
/**
* @extends RuleTestCase<ApiClassImplementsRule>
*/
class ApiClassImplementsRuleTest extends RuleTestCase
{
protected function getRule(): Rule
{
return new ApiClassImplementsRule(new ApiRuleHelper(), $this->createReflectionProvider());
}
public function testRuleInPhpStan(): void
{
$this->analyse([__DIR__ . '/data/class-implements-in-phpstan.php'], []);
}
public function testRuleOutOfPhpStan(): void
{
$tip = sprintf(
"If you think it should be covered by backward compatibility promise, open a discussion:\n %s\n\n See also:\n https://phpstan.org/developing-extensions/backward-compatibility-promise",
'https://github.com/phpstan/phpstan/discussions',
);
$this->analyse([__DIR__ . '/data/class-implements-out-of-phpstan.php'], [
[
'Implementing PHPStan\DependencyInjection\Type\DynamicThrowTypeExtensionProvider is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
20,
$tip,
],
[
'Implementing PHPStan\Type\Type is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
54,
$tip,
],
[
'Implementing PHPStan\Reflection\ReflectionProvider is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
339,
$tip,
],
[
'Implementing PHPStan\Analyser\Scope is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
344,
$tip,
],
[
'Implementing PHPStan\Reflection\FunctionReflection is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
349,
$tip,
],
[
'Implementing PHPStan\Reflection\ExtendedMethodReflection is not covered by backward compatibility promise. The interface might change in a minor PHPStan version.',
353,
$tip,
],
]);
}
}