Skip to content

Commit b883fe6

Browse files
authored
Merge pull request #96 from inpsyde/additional-sniffs
Add Sniffs for Array Spacing and Property Types
2 parents 34173b3 + afd136a commit b883fe6

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

Inpsyde/Sniffs/CodeQuality/Psr4Sniff.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
class Psr4Sniff implements Sniff
1313
{
14+
/** @var array<string, string> */
1415
public array $psr4 = [];
16+
/** @var list<string> */
1517
public array $exclude = [];
1618

1719
/**
@@ -112,10 +114,6 @@ private function checkPsr4(
112114
$filePath = str_replace('\\', '/', $file->getFilename());
113115

114116
foreach ($this->psr4 as $baseNamespace => $foldersStr) {
115-
if (!is_string($baseNamespace) || !is_string($foldersStr)) {
116-
continue;
117-
}
118-
119117
$baseNamespace = trim($baseNamespace, '\\');
120118
if (strpos($namespace, $baseNamespace) !== 0) {
121119
continue;

Inpsyde/Sniffs/CodeQuality/VariablesNameSniff.php

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class VariablesNameSniff implements Sniff
4848
];
4949

5050
public string $checkType = 'camelCase';
51+
/** @var list<string> */
5152
public array $ignoredNames = [];
5253
public bool $ignoreLocalVars = false;
5354
public bool $ignoreProperties = false;

Inpsyde/ruleset.xml

+7
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
Slevomat
121121
See https://github.com/slevomat/coding-standard
122122
-->
123+
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace">
124+
<type>warning</type>
125+
</rule>
123126
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
124127
<type>warning</type>
125128
<properties>
@@ -131,6 +134,7 @@
131134
<property name="spacesCountAroundEqualsSign" type="integer" value="0"/>
132135
</properties>
133136
</rule>
137+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint" />
134138
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
135139
<type>warning</type>
136140
<properties>
@@ -169,6 +173,9 @@
169173
</rule>
170174
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
171175
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
176+
<rule ref="Squiz.Arrays.ArrayBracketSpacing">
177+
<type>warning</type>
178+
</rule>
172179
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
173180
<rule ref="Squiz.PHP.CommentedOutCode">
174181
<properties>

tests/src/SniffMessages.php

+3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66

77
final class SniffMessages
88
{
9+
/** @var array<int, string> */
910
private array $warnings;
11+
/** @var array<int, string> */
1012
private array $errors;
13+
/** @var array<int, string> */
1114
private array $messages;
1215
private bool $messagesContainTotal = false;
1316

0 commit comments

Comments
 (0)