-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathNoMissnamedDocTagRuleTest.php
More file actions
56 lines (46 loc) · 1.56 KB
/
NoMissnamedDocTagRuleTest.php
File metadata and controls
56 lines (46 loc) · 1.56 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
52
53
54
55
56
<?php
declare(strict_types=1);
namespace Symplify\PHPStanRules\Tests\Rules\NoMissnamedDocTagRule;
use Iterator;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symplify\PHPStanRules\Rules\NoMissnamedDocTagRule;
final class NoMissnamedDocTagRuleTest extends RuleTestCase
{
/**
* @param array<int, array<string|int>> $expectedErrorMessagesWithLines
*/
#[DataProvider('provideData')]
public function testRule(string $filePath, array $expectedErrorMessagesWithLines): void
{
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}
/**
* @return Iterator<mixed>
*/
public static function provideData(): Iterator
{
yield [__DIR__ . '/Fixture/ClassMethodNonReturn.php', [
[sprintf(NoMissnamedDocTagRule::METHOD_ERROR_MESSAGE, '@var'), 12],
]];
yield [__DIR__ . '/Fixture/SomeClass.php', [
[sprintf(NoMissnamedDocTagRule::PROPERTY_ERROR_MESSAGE, '@return'), 12],
]];
yield [__DIR__ . '/Fixture/SomeConstant.php', [
[sprintf(NoMissnamedDocTagRule::CONSTANT_ERROR_MESSAGE, '@return'), 12],
]];
yield [__DIR__ . '/Fixture/SkipValidPropertyTag.php', []];
}
/**
* @return array<int, string>
*/
public static function getAdditionalConfigFiles(): array
{
return [__DIR__ . '/config/configured_rule.neon'];
}
protected function getRule(): Rule
{
return self::getContainer()->getByType(NoMissnamedDocTagRule::class);
}
}