Skip to content

Commit abd58da

Browse files
committed
New sniffs to phpcs.xml
1 parent 43904bd commit abd58da

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

SlevomatCodingStandard/Helpers/ConditionHelper.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,21 @@ public static function getNegativeCondition(
115115

116116
return sprintf(
117117
'%s%s%s',
118-
$conditionBoundaryStartPointer !== $conditionStartPointer ? TokenHelper::getContent(
119-
$phpcsFile,
120-
$conditionBoundaryStartPointer,
121-
$conditionStartPointer - 1
122-
) : '',
118+
$conditionBoundaryStartPointer !== $conditionStartPointer
119+
? TokenHelper::getContent(
120+
$phpcsFile,
121+
$conditionBoundaryStartPointer,
122+
$conditionStartPointer - 1
123+
)
124+
: '',
123125
self::getNegativeConditionPart($phpcsFile, $conditionStartPointer, $conditionEndPointer, $nested),
124-
$conditionBoundaryEndPointer !== $conditionEndPointer ? TokenHelper::getContent(
125-
$phpcsFile,
126-
$conditionEndPointer + 1,
127-
$conditionBoundaryEndPointer
128-
) : ''
126+
$conditionBoundaryEndPointer !== $conditionEndPointer
127+
? TokenHelper::getContent(
128+
$phpcsFile,
129+
$conditionEndPointer + 1,
130+
$conditionBoundaryEndPointer
131+
)
132+
: ''
129133
);
130134
}
131135

SlevomatCodingStandard/Helpers/TypeHintHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ private static function normalize(string $typeHint): string
401401

402402
if (count($convertedHints) > 1) {
403403
$convertedHints = array_map(static function (string $part): string {
404-
return TypeHintHelper::isVoidTypeHint($part) ? 'null' : $part;
404+
return self::isVoidTypeHint($part) ? 'null' : $part;
405405
}, $convertedHints);
406406
}
407407

SlevomatCodingStandard/Sniffs/Commenting/DocCommentSpacingSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,9 @@ private function checkAnnotationsGroupsOrder(
525525

526526
if (!$incorrectAnnotationsGroupsExist) {
527527
foreach ($undefinedAnnotationsGroups as $undefinedAnnotationsGroupPosition) {
528-
$annotationsGroupsPositions[$undefinedAnnotationsGroupPosition] = (count($annotationsGroupsPositions) > 0 ? max(
529-
$annotationsGroupsPositions
530-
) : 0) + 1;
528+
$annotationsGroupsPositions[$undefinedAnnotationsGroupPosition] = (count($annotationsGroupsPositions) > 0
529+
? max($annotationsGroupsPositions)
530+
: 0) + 1;
531531
}
532532
ksort($annotationsGroupsPositions);
533533

SlevomatCodingStandard/Sniffs/Namespaces/FullyQualifiedClassNameInAnnotationSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ public function process(File $phpcsFile, $docCommentOpenPointer): void
118118
$phpcsFile,
119119
$typeHint,
120120
$annotation->getStartPointer()
121-
) : NamespaceHelper::resolveName(
121+
)
122+
: NamespaceHelper::resolveName(
122123
$phpcsFile,
123124
$typeHint,
124125
ReferencedName::TYPE_CONSTANT,

build/phpcs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,12 @@
224224
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition"/>
225225
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition"/>
226226
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces"/>
227+
<rule ref="SlevomatCodingStandard.Classes.EnumCaseSpacing"/>
227228
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing"/>
228229
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
229230
<rule ref="SlevomatCodingStandard.Classes.ParentCallSpacing"/>
230231
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing"/>
232+
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference"/>
231233
<rule ref="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature">
232234
<properties>
233235
<property name="maxLineLength" value="140"/>
@@ -303,6 +305,7 @@
303305
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
304306
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty"/>
305307
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator"/>
308+
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator"/>
306309
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
307310
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
308311
<properties>
@@ -457,6 +460,7 @@
457460
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
458461

459462
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable"/>
463+
<rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable"/>
460464
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
461465
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
462466
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>

0 commit comments

Comments
 (0)