Skip to content
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

Squiz/ScopeKeywordSpacing: check spaces after abstract and final keyword #604

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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,7 @@ class ScopeKeywordSpacingSniff implements Sniff
*/
public function register()
{
$register = Tokens::$scopeModifiers;
$register[] = T_STATIC;
$register = Tokens::$methodPrefixes;
$register[] = T_READONLY;
return $register;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,30 @@ readonly class ReadonlyClassTest {}
// PHP 8.3 readonly anonymous classes.
$anon = new readonly class {};
$anon = new readonly class {};

class FinalTest {
final public static function create(ContainerInterface $container) {}
}

final class FinalTest2 {
}

final
readonly class FinalTest3 {}

class FinalTest4 {
final const X = "foo";
final public const Y = "bar";
}

abstract class AbstractTest {
abstract public function foo();
}

final class FinalSpacingCorrect {
public final const SPACING_CORRECT = true;
}

abstract class AbstractSpacingCorrect {
public abstract function spacingCorrect() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,29 @@ readonly class ReadonlyClassTest {}
// PHP 8.3 readonly anonymous classes.
$anon = new readonly class {};
$anon = new readonly class {};

class FinalTest {
final public static function create(ContainerInterface $container) {}
}

final class FinalTest2 {
}

final readonly class FinalTest3 {}

class FinalTest4 {
final const X = "foo";
final public const Y = "bar";
}

abstract class AbstractTest {
abstract public function foo();
}

final class FinalSpacingCorrect {
public final const SPACING_CORRECT = true;
}

abstract class AbstractSpacingCorrect {
public abstract function spacingCorrect() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public function getErrorList($testFile='')
140 => 3,
145 => 1,
149 => 1,
152 => 1,
155 => 1,
158 => 1,
162 => 1,
163 => 1,
166 => 1,
167 => 1,
];

case 'ScopeKeywordSpacingUnitTest.3.inc':
Expand Down
Loading