Skip to content

Commit 673cfe5

Browse files
committed
Use own styles
1 parent e7880c8 commit 673cfe5

8 files changed

+22
-24
lines changed

Inpsyde/Sniffs/CodeQuality/ElementNameMinimalLengthSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class ElementNameMinimalLengthSniff implements Sniff
4949
/**
5050
* @return int[]
5151
*/
52-
public function register(): array
52+
public function register()
5353
{
5454
return [T_CLASS, T_TRAIT, T_INTERFACE, T_CONST, T_FUNCTION, T_VARIABLE];
5555
}

Inpsyde/Sniffs/CodeQuality/ForbiddenPublicPropertySniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class ForbiddenPublicPropertySniff implements Sniff
2929
/**
3030
* @return int[]
3131
*/
32-
public function register(): array
32+
public function register()
3333
{
3434
return [T_VARIABLE];
3535
}

Inpsyde/Sniffs/CodeQuality/FunctionLengthSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class FunctionLengthSniff implements Sniff
4747
/**
4848
* @return int[]
4949
*/
50-
public function register(): array
50+
public function register()
5151
{
5252
return [T_FUNCTION];
5353
}

Inpsyde/Sniffs/CodeQuality/LineLengthSniff.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ class LineLengthSniff implements Sniff
6767
*
6868
* @var integer
6969
*/
70-
public $lineLimit = 120;
71-
70+
public $lineLimit = 100;
7271

7372
/**
74-
* Returns an array of tokens this test wants to listen for.
75-
*
76-
* @return array
73+
* @inheritdoc
7774
*/
7875
public function register()
7976
{
@@ -83,19 +80,19 @@ public function register()
8380
/**
8481
* @inheritdoc
8582
*/
86-
public function process(File $phpcsFile, $stackPtr)
83+
public function process(File $file, $position)
8784
{
88-
$tokens = $phpcsFile->getTokens();
89-
for ($i = 1; $i < $phpcsFile->numTokens; $i++) {
85+
$tokens = $file->getTokens();
86+
$start = max(1, $position);
87+
for ($i = $start; $i < $file->numTokens; $i++) {
9088
if ($tokens[$i]['column'] === 1) {
91-
$this->checkLineLength($phpcsFile, $tokens, $i);
89+
$this->checkLineLength($file, $tokens, $i);
9290
}
9391
}
9492

95-
$this->checkLineLength($phpcsFile, $tokens, $i);
96-
97-
return ($phpcsFile->numTokens + 1);
93+
$this->checkLineLength($file, $tokens, $i);
9894

95+
return ($file->numTokens + 1);
9996
}
10097

10198
/**
@@ -135,7 +132,6 @@ protected function checkLineLength(File $file, array $tokens, int $position)
135132
'TooLong',
136133
[$this->lineLimit, $length]
137134
);
138-
139135
}
140136

141137
/**
@@ -249,5 +245,4 @@ private function isI18nFunction(
249245

250246
return $tokens[$next]['code'] === T_OPEN_PARENTHESIS;
251247
}
252-
253248
}

Inpsyde/Sniffs/CodeQuality/MaxNestingLevelSniff.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class MaxNestingLevelSniff implements Sniff
6262
/**
6363
* @return int[]
6464
*/
65-
public function register(): array
65+
public function register()
6666
{
6767
return [T_FUNCTION, T_CLOSURE];
6868
}
@@ -86,8 +86,11 @@ public function process(File $file, $position)
8686
return;
8787
}
8888

89-
$this->iterateTokens($token['scope_opener'], $token['scope_closer'],
90-
$tokens);
89+
$this->iterateTokens(
90+
$token['scope_opener'],
91+
$token['scope_closer'],
92+
$tokens
93+
);
9194

9295
$this->nestingLevel = $this->subtractFunctionNestingLevel($token);
9396
$this->handleNestingLevel($this->nestingLevel);
@@ -170,7 +173,7 @@ private function handleClosureToken(array $nestedToken)
170173
*/
171174
private function handleCaseToken(array $nestedToken)
172175
{
173-
if (in_array($nestedToken['code'], [T_CASE, T_DEFAULT])) {
176+
if (in_array($nestedToken['code'], [T_CASE, T_DEFAULT], true)) {
174177
array_push($this->ignoredScopeStack, $nestedToken);
175178

176179
return;

Inpsyde/Sniffs/CodeQuality/NoElseSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class NoElseSniff implements Sniff
3232
/**
3333
* @return int[]
3434
*/
35-
public function register(): array
35+
public function register()
3636
{
3737
return [T_ELSE];
3838
}

Inpsyde/Sniffs/CodeQuality/NoSetterSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class NoSetterSniff implements Sniff
2727
/**
2828
* @return int[]
2929
*/
30-
public function register(): array
30+
public function register()
3131
{
3232
return [T_FUNCTION];
3333
}

Inpsyde/Sniffs/CodeQuality/PropertyPerClassLimitSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class PropertyPerClassLimitSniff implements Sniff
3333
/**
3434
* @return int[]
3535
*/
36-
public function register(): array
36+
public function register()
3737
{
3838
return [T_CLASS, T_TRAIT];
3939
}

0 commit comments

Comments
 (0)