Skip to content

Squiz/ScopeKeywordSpacing: update for properties with asymmetric visibility #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ class ScopeKeywordSpacingSniff implements Sniff
*/
public function register()
{
$register = Tokens::$methodPrefixes;
$register[] = T_READONLY;
$register = Tokens::$methodPrefixes;
$register += Tokens::$scopeModifiers;
$register[T_READONLY] = T_READONLY;
return $register;

}//end register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,13 @@ class FinalProperties {
final readonly public ?MyType $spacing_correct;
protected final $spacing_incorrect = 'foo';
}

class AsymVisibility {
public(set) string $asymPublic = 'hello';
public protected(set) final $asymProtected = 'hello';
private(set) public string|false $asymPrivate = 'hello';

public public(set) $asymPublicPublic = 'hello';
protected(set) public $asymPublicProtected = 'hello';
protected private(set) $asymProtectedPrivate = 'hello';
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,13 @@ class FinalProperties {
final readonly public ?MyType $spacing_correct;
protected final $spacing_incorrect = 'foo';
}

class AsymVisibility {
public(set) string $asymPublic = 'hello';
public protected(set) final $asymProtected = 'hello';
private(set) public string|false $asymPrivate = 'hello';

public public(set) $asymPublicPublic = 'hello';
protected(set) public $asymPublicProtected = 'hello';
protected private(set) $asymProtectedPrivate = 'hello';
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function getErrorList($testFile='')
187 => 1,
188 => 1,
193 => 2,
197 => 1,
198 => 3,
199 => 2,
];

case 'ScopeKeywordSpacingUnitTest.3.inc':
Expand Down