Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sniffs for Array Spacing and Property Types #96

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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