Skip to content

Commit f49df21

Browse files
committed
PHP 7.4 | Squiz/ScopeKeywordSpacing: add tests with typed properties
1 parent 377a467 commit f49df21

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.inc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,16 @@ public function fCreate($attributes = []): object|static
9494
{
9595
}
9696

97-
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type dclaration is still handled.
97+
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type declaration is still handled.
9898
$callback = $cond ? get_fn_name() : static function ($a) { return $a * 10; };
99+
100+
class TypedProperties {
101+
public
102+
int $var;
103+
104+
protected string $stringA, $stringB;
105+
106+
private bool
107+
$boolA,
108+
$boolB;
109+
}

src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.inc.fixed

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,15 @@ public function fCreate($attributes = []): object|static
8989
{
9090
}
9191

92-
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type dclaration is still handled.
92+
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type declaration is still handled.
9393
$callback = $cond ? get_fn_name() : static function ($a) { return $a * 10; };
94+
95+
class TypedProperties {
96+
public int $var;
97+
98+
protected string $stringA, $stringB;
99+
100+
private bool
101+
$boolA,
102+
$boolB;
103+
}

src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ class ScopeKeywordSpacingUnitTest extends AbstractSniffUnitTest
2626
public function getErrorList()
2727
{
2828
return [
29-
7 => 2,
30-
8 => 1,
31-
13 => 1,
32-
14 => 1,
33-
15 => 1,
34-
17 => 2,
35-
26 => 1,
36-
28 => 1,
37-
29 => 1,
38-
64 => 1,
39-
67 => 1,
40-
71 => 1,
41-
98 => 1,
29+
7 => 2,
30+
8 => 1,
31+
13 => 1,
32+
14 => 1,
33+
15 => 1,
34+
17 => 2,
35+
26 => 1,
36+
28 => 1,
37+
29 => 1,
38+
64 => 1,
39+
67 => 1,
40+
71 => 1,
41+
98 => 1,
42+
101 => 1,
43+
106 => 1,
4244
];
4345

4446
}//end getErrorList()

0 commit comments

Comments
 (0)