Skip to content

Commit cf65208

Browse files
committed
Improve readability
1 parent ee88af9 commit cf65208

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

IxDFCodingStandard/Sniffs/Classes/ForbidMethodDeclarationSniff.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ final class ForbidMethodDeclarationSniff implements Sniff
1111
public const FORBIDDEN_METHOD_DECLARATION = 'ForbiddenMethodDeclaration';
1212

1313
/**
14-
* A list of methods which should not be declared
15-
* in specific.
14+
* A list of forbidden to declare methods.
1615
* @var array<string, string>
1716
*/
1817
public $forbiddenMethods = [];

IxDFCodingStandard/Sniffs/NamingConventions/CamelCaseRouteNameSniff.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@
77

88
final class CamelCaseRouteNameSniff implements Sniff
99
{
10-
private const CAMEL_CASE_PATTERN = '/^[^-_\s]++$/';
11-
1210
public const CODE_NOT_CAMEL_CASE_ROUTE_NAME = 'NotCamelCaseRouteName';
1311

12+
private const PATTERN_CAMEL_CASE = '/^[^-_\s]++$/';
13+
1414
/** @inheritDoc */
1515
public function register(): array
1616
{
1717
return [\T_STRING];
1818
}
1919

2020
/** @inheritDoc */
21-
public function process(File $phpcsFile, $stackPtr): void
21+
public function process(File $phpcsFile, $stringPointer): void
2222
{
2323
$tokens = $phpcsFile->getTokens();
24-
$currentToken = $tokens[$stackPtr];
24+
$currentToken = $tokens[$stringPointer];
2525

2626
if ($currentToken['content'] !== 'name') {
2727
return;
2828
}
2929

30-
$this->processRouteName($phpcsFile, $stackPtr, $tokens);
30+
$this->processRouteName($phpcsFile, $stringPointer, $tokens);
3131
}
3232

3333
/**
3434
* Finds the route name and tests it against the camel case pattern.
3535
* If an issue is found, it adds an error.
3636
* @param array<string, int, array<string>> $tokens
3737
**/
38-
public function processRouteName(File $phpcsFile, int $stackPtr, array $tokens): void
38+
public function processRouteName(File $phpcsFile, int $stackPointer, array $tokens): void
3939
{
40-
$routeNameLocation = $phpcsFile->findNext(\T_CONSTANT_ENCAPSED_STRING, $stackPtr);
40+
$routeNameLocation = $phpcsFile->findNext(\T_CONSTANT_ENCAPSED_STRING, $stackPointer);
4141
$routeName = $tokens[$routeNameLocation]['content'];
4242

4343
if (!$this->isCamelCase($routeName)) {
@@ -58,7 +58,7 @@ private function isCamelCase(string $routeName): bool
5858
$parts = explode('.', $routeName);
5959

6060
foreach ($parts as $part) {
61-
if (preg_match(self::CAMEL_CASE_PATTERN, $part) !== 1) {
61+
if (preg_match(self::PATTERN_CAMEL_CASE, $part) !== 1) {
6262
return false;
6363
}
6464
}

0 commit comments

Comments
 (0)