Skip to content

Commit bdec83b

Browse files
committed
Squiz/ScopeKeywordSpacing: add additional tests
This commit adds a few of tests for syntaxes in which the target keywords could be used, which were so far not covered by tests: * Tests with the `static` modifier keyword being used for closures. * Tests with visibility keyword applied to class constants.
1 parent df89db1 commit bdec83b

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,16 @@ final class FinalSpacingCorrect {
174174
abstract class AbstractSpacingCorrect {
175175
public abstract function spacingCorrect() {}
176176
}
177+
178+
$closure = static function() { return 'spacing correct'; };
179+
$closure = static function() { return 'spacing incorrect'; };
180+
181+
class ConstantVisibility {
182+
public const PUBLIC_SPACING_CORRECT = true;
183+
protected const PROTECTED_SPACING_CORRECT = true;
184+
private const PRIVATE_SPACING_CORRECT = true;
185+
186+
public const PUBLIC_SPACING_INCORRECT = true;
187+
protected const PROTECTED_SPACING_INCORRECT = true;
188+
private const PRIVATE_SPACING_INCORRECT = true;
189+
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,16 @@ final class FinalSpacingCorrect {
167167
abstract class AbstractSpacingCorrect {
168168
public abstract function spacingCorrect() {}
169169
}
170+
171+
$closure = static function() { return 'spacing correct'; };
172+
$closure = static function() { return 'spacing incorrect'; };
173+
174+
class ConstantVisibility {
175+
public const PUBLIC_SPACING_CORRECT = true;
176+
protected const PROTECTED_SPACING_CORRECT = true;
177+
private const PRIVATE_SPACING_CORRECT = true;
178+
179+
public const PUBLIC_SPACING_INCORRECT = true;
180+
protected const PROTECTED_SPACING_INCORRECT = true;
181+
private const PRIVATE_SPACING_INCORRECT = true;
182+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public function getErrorList($testFile='')
6565
163 => 1,
6666
166 => 1,
6767
167 => 1,
68+
179 => 1,
69+
186 => 1,
70+
187 => 1,
71+
188 => 1,
6872
];
6973

7074
case 'ScopeKeywordSpacingUnitTest.3.inc':

0 commit comments

Comments
 (0)