Skip to content
Closed
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
8 changes: 8 additions & 0 deletions Consistence/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="caseSensitive" value="true"/>
Expand Down Expand Up @@ -127,8 +131,10 @@
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
Expand All @@ -147,6 +153,8 @@
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces"/>
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing">
<exclude name="Squiz.Arrays.ArrayBracketSpacing.SpaceBeforeBracket"/><!-- does not handle nested array access across multiple lines -->
</rule>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "~7.1",
"squizlabs/php_codesniffer": "~3.3.0",
"slevomat/coding-standard": "~4.6"
"slevomat/coding-standard": "~4.7"
},
"require-dev": {
"jakub-onderka/php-console-highlighter": "0.3.2",
Expand Down
8 changes: 4 additions & 4 deletions tests/Sniffs/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function assertSniffError(PhpCsFile $resultFile, int $line, string $co
sprintf(
'Expected code %s%s, but not found on line %s.%sErrors found on this line:%s%s%s',
$expectedCode,
($message !== null) ? sprintf(' with message "%s"', $message) : '',
$message !== null ? sprintf(' with message "%s"', $message) : '',
$line,
PHP_EOL,
PHP_EOL,
Expand Down Expand Up @@ -162,7 +162,7 @@ protected function assertNoSniffErrorInFile(PhpCsFile $file): void
private function getFormattedErrorsForFile(array $errorsForFile): string
{
$message = '';
foreach ($errorsForFile as $line => $errorsForPossition) {
foreach (array_keys($errorsForFile) as $line) {
$message .= sprintf(
'%d:%s%s%s',
$line,
Expand All @@ -186,8 +186,8 @@ private function getFormattedErrorsOnLine(array $errorsForFile, int $line): stri
return '';
}

return implode(PHP_EOL, array_map(function (array $errorsForPosition) {
return implode(PHP_EOL, array_map(function (array $errorForPosition) {
return implode(PHP_EOL, array_map(static function (array $errorsForPosition) {
return implode(PHP_EOL, array_map(static function (array $errorForPosition) {
return sprintf("\t" . '%s: %s', $errorForPosition['source'], $errorForPosition['message']);
}, $errorsForPosition));
}, $errorsForFile[$line]));
Expand Down