Skip to content

Commit 925a200

Browse files
authored
Merge pull request #21 from php-collective/next
Trailing comma sniffs.
2 parents ed7e59b + 5540b49 commit 925a200

21 files changed

+219
-55
lines changed

PhpCollective/Sniffs/AbstractSniffs/AbstractSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ protected function getMethodSignatureMultilineLength(
584584
array $tokens,
585585
int $stackPtr,
586586
array $methodProperties,
587-
array $methodParameters
587+
array $methodParameters,
588588
): int {
589589
$totalLength = $this->getMethodSingleLineSignatureLength($tokens, $stackPtr);
590590
$firstLineEndPosition = $this->getLineEndingPosition($tokens, $stackPtr);

PhpCollective/Sniffs/Classes/MethodArgumentDefaultValueSniff.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,9 @@ protected function removeDefaultArgument(File $phpcsFile, int $startIndex, int $
147147
*/
148148
protected function isTypehintedNullableVariable(File $phpcsFile, int $index): bool
149149
{
150-
$tokens = $phpcsFile->getTokens();
151-
152-
$nextIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $index + 1, null, true);
153-
154-
$nextToken = $tokens[$nextIndex];
150+
//$tokens = $phpcsFile->getTokens();
151+
//$nextIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $index + 1, null, true);
152+
//$nextToken = $tokens[$nextIndex];
155153

156154
/*
157155
if (!$nextToken->equals([T_STRING, 'null'], false)) {

PhpCollective/Sniffs/Commenting/DisallowArrayTypeHintSyntaxSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ protected function findGenericIdentifier(
307307
File $phpcsFile,
308308
int $docCommentOpenPointer,
309309
TypeNode $typeNode,
310-
PhpDocTagValueNode $annotationValue
310+
PhpDocTagValueNode $annotationValue,
311311
): ?string {
312312
if (!$typeNode instanceof UnionTypeNode) {
313313
if (!$annotationValue instanceof ParamTagValueNode && !$annotationValue instanceof ReturnTagValueNode) {
@@ -501,7 +501,7 @@ protected function fixGenericObjectCollection(
501501
Annotation $annotation,
502502
int $docCommentOpenPointer,
503503
ArrayTypeNode $typeNode,
504-
array $unionTypeNodes
504+
array $unionTypeNodes,
505505
): void {
506506
$genericType = null;
507507
$arrayType = null;

PhpCollective/Sniffs/Commenting/DocBlockConstSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ protected function handleMissingVar(
236236
File $phpCsFile,
237237
int $docBlockEndIndex,
238238
int $docBlockStartIndex,
239-
?string $defaultValueType
239+
?string $defaultValueType,
240240
): void {
241241
$error = 'Doc Block annotation @var for const missing';
242242

PhpCollective/Sniffs/Commenting/DocBlockReturnNullableTypeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function assertNotNullableReturnType(File $phpCsFile, int $stackPointer,
160160
public function assertRequiredNullableReturnType(
161161
File $phpCsFile,
162162
int $stackPointer,
163-
array $docBlockReturnTypes
163+
array $docBlockReturnTypes,
164164
): void {
165165
if (!$docBlockReturnTypes) {
166166
return;

PhpCollective/Sniffs/Commenting/DocBlockReturnSelfSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function assertCorrectDocBlockParts(
9898
int $classNameIndex,
9999
array $parts,
100100
array $returnTypes,
101-
string $appendix
101+
string $appendix,
102102
): void {
103103
$result = [];
104104
foreach ($parts as $key => $part) {
@@ -185,7 +185,7 @@ protected function fixClassToThis(
185185
int $classNameIndex,
186186
array $parts,
187187
string $appendix,
188-
array $returnTypes
188+
array $returnTypes,
189189
): void {
190190
$ownClassName = '\\' . $this->getClassName($phpCsFile);
191191

@@ -295,7 +295,7 @@ protected function assertChainableReturnType(
295295
File $phpCsFile,
296296
int $stackPointer,
297297
array $parts,
298-
array $returnTypes
298+
array $returnTypes,
299299
): void {
300300
if ($returnTypes && $parts === ['$this'] && $returnTypes !== ['$this']) {
301301
$phpCsFile->addError('Chainable method (@return $this) cannot have multiple return types in code.', $stackPointer, 'InvalidChainable');

PhpCollective/Sniffs/Commenting/DocBlockReturnVoidSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ protected function addReturnAnnotation(
181181
File $phpcsFile,
182182
int $docBlockStartIndex,
183183
int $docBlockEndIndex,
184-
string $returnType = 'void'
184+
string $returnType = 'void',
185185
): void {
186186
$indentation = $this->getIndentationWhitespace($phpcsFile, $docBlockEndIndex);
187187

@@ -250,7 +250,7 @@ protected function assertExisting(
250250
File $phpcsFile,
251251
int $pointer,
252252
int $docBlockReturnIndex,
253-
?string $returnType
253+
?string $returnType,
254254
): void {
255255
$tokens = $phpcsFile->getTokens();
256256

PhpCollective/Sniffs/Commenting/DocBlockTagIterableSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function process(File $phpcsFile, $stackPtr): void
4040

4141
$tag = $content;
4242
if (str_contains($tag, ' ')) {
43-
[$tag, $description] = explode(' ', $content, 2);
43+
[$tag] = explode(' ', $content, 2);
4444
}
4545

4646
if (!preg_match('#^@(?:[a-z]+-)?(?:param|return|var)\b#i', $tag)) {

PhpCollective/Sniffs/Commenting/DocBlockThrowsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ protected function compareExceptionsAndAnnotations(
251251
File $phpCsFile,
252252
array $exceptions,
253253
array $annotations,
254-
int $docBlockEndIndex
254+
int $docBlockEndIndex,
255255
): void {
256256
$useStatements = $this->getUseStatements($phpCsFile);
257257

PhpCollective/Sniffs/Commenting/DocBlockVarSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected function handleMissingVar(
214214
File $phpCsFile,
215215
int $docBlockEndIndex,
216216
int $docBlockStartIndex,
217-
?string $defaultValueType
217+
?string $defaultValueType,
218218
): void {
219219
$error = 'Doc Block annotation @var for property missing';
220220
if ($defaultValueType === null) {

0 commit comments

Comments
 (0)