|
17 | 17 |
|
18 | 18 | class CallableDefinitionSniffTest extends SnifferTest |
19 | 19 | { |
20 | | - /** @dataProvider properties */ |
21 | | - public function test_CallableParamDoc_WithoutDefinition_GivesWarning(array $properties, array $expectedWarningLines) |
| 20 | + /** @dataProvider warningsForProperties */ |
| 21 | + public function test_CallableParamDoc_WithoutDefinition_GivesWarning(array $warningLines, array $properties) |
22 | 22 | { |
23 | | - $this->setProperties($properties); |
24 | | - $this->assertWarningLines('./tests/Fixtures/code-samples/Sniffs/PhpDocCallableDefinitions.php', $expectedWarningLines); |
| 23 | + $this->assertWarningLines($warningLines, 'PhpDocCallableDefinitions.php', $properties); |
25 | 24 | } |
26 | 25 |
|
27 | | - public static function properties(): iterable |
| 26 | + public static function warningsForProperties(): iterable |
28 | 27 | { |
29 | 28 | return [ |
30 | | - [['syntax' => 'both', 'includeClosure' => false], range(15, 18)], |
31 | | - [['syntax' => 'both', 'includeClosure' => true], range(15, 22)], |
32 | | - [['syntax' => 'short', 'includeClosure' => false], array_merge(range(15, 18), [27, 28, 31])], |
33 | | - [['syntax' => 'long', 'includeClosure' => false], array_merge(range(15, 18), [23, 24], [33])], |
34 | | - [['syntax' => 'short', 'includeClosure' => true], array_merge(range(15, 22), range(27, 31))], |
35 | | - [['syntax' => 'long', 'includeClosure' => true], array_merge(range(15, 26), [32, 33, 34])] |
| 29 | + 'short+long closure(-)' => [range(15, 18), ['syntax' => 'both', 'includeClosure' => false]], |
| 30 | + 'short+long closure(+)' => [range(15, 22), ['syntax' => 'both', 'includeClosure' => true]], |
| 31 | + 'short closure (-)' => [array_merge(range(15, 18), [27, 28, 31]), ['syntax' => 'short', 'includeClosure' => false]], |
| 32 | + 'long closure (-)' => [array_merge(range(15, 18), [23, 24], [33]), ['syntax' => 'long', 'includeClosure' => false]], |
| 33 | + 'short closure (+)' => [array_merge(range(15, 22), range(27, 31)), ['syntax' => 'short', 'includeClosure' => true]], |
| 34 | + 'long closure (+)' => [array_merge(range(15, 26), [32, 33, 34]), ['syntax' => 'long', 'includeClosure' => true]] |
36 | 35 | ]; |
37 | 36 | } |
38 | 37 |
|
39 | | - protected function sniffer(): string |
| 38 | + protected function sniffClass(): string |
40 | 39 | { |
41 | 40 | return CallableDefinitionSniff::class; |
42 | 41 | } |
|
0 commit comments