Skip to content

Commit 91c8726

Browse files
committed
Merge branch 'master' into 4.x
2 parents fcb3ecd + 572c70a commit 91c8726

8 files changed

+63
-3
lines changed

src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ protected function processMemberVar(File $phpcsFile, $stackPtr)
6464

6565
$endOfPreviousStatement = $phpcsFile->findPrevious($stopPoints, ($stackPtr - 1), null, false, null, true);
6666

67-
$validPrefixes = Tokens::METHOD_MODIFIERS;
67+
$validPrefixes = Tokens::SCOPE_MODIFIERS;
68+
$validPrefixes[] = T_STATIC;
69+
$validPrefixes[] = T_FINAL;
6870
$validPrefixes[] = T_VAR;
6971
$validPrefixes[] = T_READONLY;
7072

src/Standards/Squiz/Sniffs/WhiteSpace/ScopeKeywordSpacingSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ class ScopeKeywordSpacingSniff implements Sniff
2424
*/
2525
public function register()
2626
{
27-
$register = Tokens::METHOD_MODIFIERS;
28-
$register[] = T_READONLY;
27+
$register = Tokens::METHOD_MODIFIERS;
28+
$register += Tokens::SCOPE_MODIFIERS;
29+
$register[T_READONLY] = T_READONLY;
2930
return $register;
3031

3132
}//end register()

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,18 @@ class MultilineCommentShouldNotBeSplitUp {
444444
*/
445445
public $prop;
446446
}
447+
448+
class AsymVisibility {
449+
protected private(set) int $asymProtectedPrivate;
450+
451+
/**
452+
* Docblock
453+
*/
454+
protected(set) final string $asymProtected;
455+
#[AnAttribute]
456+
457+
public(set) string|bool $asymPublic;
458+
459+
460+
private(set) private bool $asymPrivate;
461+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,18 @@ class MultilineCommentShouldNotBeSplitUp {
431431
*/
432432
public $prop;
433433
}
434+
435+
class AsymVisibility {
436+
437+
protected private(set) int $asymProtectedPrivate;
438+
439+
/**
440+
* Docblock
441+
*/
442+
protected(set) final string $asymProtected;
443+
444+
#[AnAttribute]
445+
public(set) string|bool $asymPublic;
446+
447+
private(set) private bool $asymPrivate;
448+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public function getErrorList($testFile='')
8787
427 => 1,
8888
437 => 1,
8989
445 => 1,
90+
449 => 1,
91+
456 => 1,
92+
457 => 1,
93+
460 => 1,
9094
];
9195

9296
default:

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,13 @@ class FinalProperties {
192192
final readonly public ?MyType $spacing_correct;
193193
protected final $spacing_incorrect = 'foo';
194194
}
195+
196+
class AsymVisibility {
197+
public(set) string $asymPublic = 'hello';
198+
public protected(set) final $asymProtected = 'hello';
199+
private(set) public string|false $asymPrivate = 'hello';
200+
201+
public public(set) $asymPublicPublic = 'hello';
202+
protected(set) public $asymPublicProtected = 'hello';
203+
protected private(set) $asymProtectedPrivate = 'hello';
204+
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,13 @@ class FinalProperties {
185185
final readonly public ?MyType $spacing_correct;
186186
protected final $spacing_incorrect = 'foo';
187187
}
188+
189+
class AsymVisibility {
190+
public(set) string $asymPublic = 'hello';
191+
public protected(set) final $asymProtected = 'hello';
192+
private(set) public string|false $asymPrivate = 'hello';
193+
194+
public public(set) $asymPublicPublic = 'hello';
195+
protected(set) public $asymPublicProtected = 'hello';
196+
protected private(set) $asymProtectedPrivate = 'hello';
197+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public function getErrorList($testFile='')
7070
187 => 1,
7171
188 => 1,
7272
193 => 2,
73+
197 => 1,
74+
198 => 3,
75+
199 => 2,
7376
];
7477

7578
case 'ScopeKeywordSpacingUnitTest.3.inc':

0 commit comments

Comments
 (0)