Skip to content

Commit 702121d

Browse files
committed
Add more useful sniffs.
1 parent 1ac6250 commit 702121d

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

PhpCollective/Sniffs/Classes/Psr4Sniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ protected function addError(
142142

143143
$phpcsFile->addError(
144144
sprintf(
145-
'Class name is not compliant with PSR-4 configuration. ' .
146-
'It should be `%s` instead of `%s`.',
145+
'Class name is not compliant with PSR-4 configuration. '
146+
. 'It should be `%s` instead of `%s`.',
147147
$result->getExpectedClassName(),
148148
$result->getActualClassName(),
149149
),

PhpCollective/Sniffs/Internal/DisallowFunctionsSniff.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class DisallowFunctionsSniff extends AbstractSniff
4242
/**
4343
* @var array<string, array<string>>
4444
*/
45-
protected static array $methods = [
46-
];
45+
protected static array $methods = [];
4746

4847
/**
4948
* @var bool|null

PhpCollective/Sniffs/PHP/DeclareStrictTypesSniff.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ class DeclareStrictTypesSniff implements Sniff
1818
* @var array<int|string>
1919
*/
2020
protected const TOKEN_CODES_TO_CHECK = [
21-
T_OPEN_PARENTHESIS, T_STRING, T_EQUAL, T_LNUMBER, T_CLOSE_PARENTHESIS, T_SEMICOLON, T_COMMENT,
21+
T_OPEN_PARENTHESIS,
22+
T_STRING,
23+
T_EQUAL,
24+
T_LNUMBER,
25+
T_CLOSE_PARENTHESIS,
26+
T_SEMICOLON,
27+
T_COMMENT,
2228
];
2329

2430
/**

PhpCollective/Tools/Tokenizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(array $argv)
5252
throw new Exception('Please provide a valid file.');
5353
}
5454

55-
$this->root = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
55+
$this->root = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR;
5656
$this->path = $file;
5757
$this->verbose = !empty($argv[2]) && in_array($argv[2], ['--verbose', '-v']);
5858
}

PhpCollective/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250

251251
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
252252

253+
<rule ref="Generic.Arrays.ArrayIndent"/>
253254
<rule ref="Universal.Constants.LowercaseClassResolutionKeyword"/>
254255
<rule ref="Universal.Constants.UppercaseMagicConstants"/>
255256
<rule ref="Universal.WhiteSpace.PrecisionAlignment"/>

docs/sniffs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# PhpCollective Code Sniffer
22

33

4-
The PhpCollectiveStrict standard contains 232 sniffs
4+
The PhpCollectiveStrict standard contains 233 sniffs
55

6-
Generic (26 sniffs)
6+
Generic (27 sniffs)
77
-------------------
8+
- Generic.Arrays.ArrayIndent
89
- Generic.Arrays.DisallowLongArraySyntax
910
- Generic.CodeAnalysis.ForLoopShouldBeWhileLoop
1011
- Generic.CodeAnalysis.ForLoopWithTestFunctionCall

0 commit comments

Comments
 (0)