Skip to content

Commit

Permalink
Merge pull request #96 from inpsyde/additional-sniffs
Browse files Browse the repository at this point in the history
Add Sniffs for Array Spacing and Property Types
  • Loading branch information
tfrommen authored Jul 25, 2024
2 parents 34173b3 + afd136a commit b883fe6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Inpsyde/Sniffs/CodeQuality/Psr4Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

class Psr4Sniff implements Sniff
{
/** @var array<string, string> */
public array $psr4 = [];
/** @var list<string> */
public array $exclude = [];

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

foreach ($this->psr4 as $baseNamespace => $foldersStr) {
if (!is_string($baseNamespace) || !is_string($foldersStr)) {
continue;
}

$baseNamespace = trim($baseNamespace, '\\');
if (strpos($namespace, $baseNamespace) !== 0) {
continue;
Expand Down
1 change: 1 addition & 0 deletions Inpsyde/Sniffs/CodeQuality/VariablesNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class VariablesNameSniff implements Sniff
];

public string $checkType = 'camelCase';
/** @var list<string> */
public array $ignoredNames = [];
public bool $ignoreLocalVars = false;
public bool $ignoreProperties = false;
Expand Down
7 changes: 7 additions & 0 deletions Inpsyde/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
Slevomat
See https://github.com/slevomat/coding-standard
-->
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace">
<type>warning</type>
</rule>
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
<type>warning</type>
<properties>
Expand All @@ -131,6 +134,7 @@
<property name="spacesCountAroundEqualsSign" type="integer" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint" />
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
<type>warning</type>
<properties>
Expand Down Expand Up @@ -169,6 +173,9 @@
</rule>
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing">
<type>warning</type>
</rule>
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
Expand Down
3 changes: 3 additions & 0 deletions tests/src/SniffMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

final class SniffMessages
{
/** @var array<int, string> */
private array $warnings;
/** @var array<int, string> */
private array $errors;
/** @var array<int, string> */
private array $messages;
private bool $messagesContainTotal = false;

Expand Down

0 comments on commit b883fe6

Please sign in to comment.