Skip to content

Commit 4a761e8

Browse files
committed
refactor(DataTypeNamespace): Replace sniff with Slevomat sniff
1 parent 702cae9 commit 4a761e8

File tree

12 files changed

+24
-163
lines changed

12 files changed

+24
-163
lines changed

coder_sniffer/Drupal/Sniffs/Commenting/DataTypeNamespaceSniff.php

Lines changed: 0 additions & 103 deletions
This file was deleted.

coder_sniffer/Drupal/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
</rule>
137137
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
138138
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
139+
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
139140
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
140141
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
141142
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>

tests/Drupal/Commenting/DataTypeNamespaceUnitTest.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/Drupal/Commenting/DocCommentUnitTest.inc.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @return bool
1515
* Returns FALSE.
1616
*
17-
* @throws Exception
17+
* @throws \Exception
1818
* Thrown when $param is TRUE.
1919
*
2020
* @ingroup sniffer
@@ -97,7 +97,7 @@ function test12() {
9797
* | Unseen University | Mustrum Ridcully | Alberto Malich the Wise | 1281 AM | Nvnc Id Vides, Nvnc Ne Vides |
9898
* phpcs:enable
9999
*
100-
* @param TableNode $organisation_table
100+
* @param \TableNode $organisation_table
101101
* The organisation data.
102102
*
103103
* @Given (the following )organisations:

tests/Drupal/bad/BadUnitTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ protected function getErrorList(string $testFile): array
309309
638 => 1,
310310
646 => 2,
311311
648 => 1,
312-
656 => 1,
312+
656 => 2,
313313
658 => 1,
314-
661 => 1,
314+
661 => 2,
315315
671 => 1,
316316
678 => 1,
317317
685 => 1,
@@ -389,6 +389,13 @@ protected function getErrorList(string $testFile): array
389389
16 => 1,
390390
31 => 1,
391391
];
392+
case 'DataTypeNamespaceUnitTest.inc':
393+
return [
394+
15 => 1,
395+
18 => 1,
396+
21 => 1,
397+
31 => 1,
398+
];
392399
case 'FinallySpacingUnitTest.inc':
393400
return [
394401
1 => 1,
@@ -421,8 +428,10 @@ protected function getErrorList(string $testFile): array
421428
22 => 1,
422429
23 => 1,
423430
35 => 1,
431+
42 => 1,
424432
56 => 1,
425433
85 => 1,
434+
87 => 1,
426435
98 => 1,
427436
];
428437
case 'UseLeadingBackslashUnitTest.inc':

tests/Drupal/bad/UnusedUseStatementUnitTest.inc.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UnusedUseStatementUnitTest {
2626
/**
2727
* Aliased type that is otherwise unused.
2828
*
29-
* @var AliasVarName2
29+
* @var \Some\Data\VarName2
3030
*/
3131
protected $y;
3232

@@ -71,7 +71,7 @@ class UnusedUseStatementUnitTest {
7171
protected function test6($x) {
7272
/** @var \Some\Data\VarName $y */
7373
$y = $x['test'];
74-
/** @var AliasVarName2 $z */
74+
/** @var \Some\Data\VarName2 $z */
7575
$z = $x['test2'];
7676
return $y;
7777
}

tests/Drupal/bad/bad.php.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ function test14() {
672672
/**
673673
* Return data type documentation must not be the variable name.
674674
*
675-
* @return foo
675+
* @return \foo
676676
* Description bla.
677677
*/
678678
function test15() {
@@ -690,12 +690,12 @@ function test16() {
690690
/**
691691
* Invalid data types.
692692
*
693-
* @param mixed $x
693+
* @param \type $x
694694
* Description here.
695695
* @param bool $y
696696
* Description here.
697697
*
698-
* @return unknown_type
698+
* @return \unknown_type
699699
* Description here.
700700
*/
701701
function test17($x, $y) {

tests/Drupal/good/GoodDocBlock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function getConfiguration() {
105105
* The second version of this test with error name with underscores
106106
* is added below.
107107
*
108-
* @throws Exception
108+
* @throws \Exception
109109
*/
110110
public function test6() {
111111
throw new Exception();

0 commit comments

Comments
 (0)