Skip to content

Commit a9a2530

Browse files
committed
Adjust tests and rules
Drops the single line rule for docblocks and aligns tests with expectations.
1 parent 0ffed91 commit a9a2530

File tree

5 files changed

+20
-29
lines changed

5 files changed

+20
-29
lines changed

src/DMS/ruleset.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<rule ref="Doctrine">
77
<exclude name="Squiz.PHP.GlobalKeyword" />
88
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
9+
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment"/>
910
</rule>
1011

1112
<!-- Require presence of declare(strict_types=1) -->
@@ -23,4 +24,6 @@
2324
<property name="spacesCountBeforeColon" value="0"/>
2425
</properties>
2526
</rule>
27+
28+
2629
</ruleset>

tests/expected_report.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ PHP CODE SNIFFER REPORT SUMMARY
44
FILE ERRORS WARNINGS
55
----------------------------------------------------------------------
66
tests/input/concatenation_spacing.php 55 0
7-
tests/input/example-class.php 36 0
7+
tests/input/example-class.php 38 0
88
tests/input/not_spacing.php 7 0
9-
tests/input/return_type_on_closures.php 27 0
10-
tests/input/return_type_on_methods.php 13 0
9+
tests/input/return_type_on_closures.php 32 0
10+
tests/input/return_type_on_methods.php 18 0
1111
tests/input/test-case.php 7 0
1212
----------------------------------------------------------------------
13-
A TOTAL OF 145 ERRORS AND 0 WARNINGS WERE FOUND IN 6 FILES
13+
A TOTAL OF 157 ERRORS AND 0 WARNINGS WERE FOUND IN 6 FILES
1414
----------------------------------------------------------------------
15-
PHPCBF CAN FIX 134 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
15+
PHPCBF CAN FIX 146 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
1616
----------------------------------------------------------------------
1717

1818

tests/fixed/example-class.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,17 @@ class Example implements IteratorAggregate
2525
{
2626
private const VERSION = PHP_VERSION - (PHP_MINOR_VERSION * 100) - PHP_PATCH_VERSION;
2727

28-
private ?int $foo = null;
29-
30-
/**
31-
* @var string[]
32-
*/
33-
private array $bar;
34-
35-
private bool $baz;
36-
3728
private ControlStructureSniff|int|string|null $baxBax = null;
3829

39-
public function __construct(?int $foo = null, array $bar = [], bool $baz = false, $baxBax = 'unused')
30+
public function __construct(private int|null $foo = null, private array $bar = [], private bool $baz = false, $baxBax = 'unused')
4031
{
41-
$this->foo = $foo;
42-
$this->bar = $bar;
43-
$this->baz = $baz;
4432
$this->baxBax = $baxBax;
4533
}
4634

4735
/**
4836
* Description
4937
*/
50-
public function getFoo(): ?int
38+
public function getFoo(): int|null
5139
{
5240
return $this->foo;
5341
}

tests/fixed/return_type_on_closures.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static function (
2222
int $c,
2323
int $d,
2424
int $e,
25-
int $b
25+
int $b,
2626
): void {
2727
}
2828

@@ -31,7 +31,7 @@ static function (
3131
int $c,
3232
int $d,
3333
int $e,
34-
int $b
34+
int $b,
3535
): void {
3636
}
3737

@@ -40,7 +40,7 @@ static function (
4040
int $c,
4141
int $d,
4242
int $e,
43-
int $b
43+
int $b,
4444
): void {
4545
}
4646

@@ -49,7 +49,7 @@ static function (
4949
int $c,
5050
int $d,
5151
int $e,
52-
int $b
52+
int $b,
5353
): void {
5454
}
5555

@@ -58,6 +58,6 @@ static function (
5858
int $c,
5959
int $d,
6060
int $e,
61-
int $b
61+
int $b,
6262
): void {
6363
}

tests/fixed/return_type_on_methods.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function f(
3131
int $c,
3232
int $d,
3333
int $e,
34-
int $b
34+
int $b,
3535
): void {
3636
}
3737

@@ -40,7 +40,7 @@ public function g(
4040
int $c,
4141
int $d,
4242
int $e,
43-
int $b
43+
int $b,
4444
): void {
4545
}
4646

@@ -49,7 +49,7 @@ public function h(
4949
int $c,
5050
int $d,
5151
int $e,
52-
int $b
52+
int $b,
5353
): void {
5454
}
5555

@@ -58,7 +58,7 @@ public function i(
5858
int $c,
5959
int $d,
6060
int $e,
61-
int $b
61+
int $b,
6262
): void {
6363
}
6464

@@ -67,7 +67,7 @@ public function j(
6767
int $c,
6868
int $d,
6969
int $e,
70-
int $b
70+
int $b,
7171
): void {
7272
}
7373
}

0 commit comments

Comments
 (0)