Skip to content

Commit 111725a

Browse files
committed
Fix PHPStan.
1 parent 6394a53 commit 111725a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

PhpCollective/Sniffs/Commenting/DocBlockVarNotJustNullSniff.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public function process(File $phpCsFile, $stackPointer): void
6969
return;
7070
}
7171

72-
$typeIndex = $varIndex + 2;
72+
$typeIndex = (int)$varIndex + 2;
73+
if (!isset($tokens[$typeIndex]) || !isset($tokens[$typeIndex]['content'])) {
74+
return;
75+
}
7376

7477
$content = $tokens[$typeIndex]['content'];
7578
$spaceIndex = strpos($content, ' ');

PhpCollective/Sniffs/Formatting/ArrayDeclarationSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ public function processMultiLineArray(File $phpcsFile, int $stackPtr, int $array
282282
$nextToken,
283283
true,
284284
);
285+
if ($valueContent === false) {
286+
continue;
287+
}
285288

286289
$indices[] = ['value' => $valueContent];
287290
}
@@ -319,6 +322,10 @@ public function processMultiLineArray(File $phpcsFile, int $stackPtr, int $array
319322
true,
320323
);
321324

325+
if ($nextContent === false) {
326+
continue;
327+
}
328+
322329
$currentEntry['value'] = $nextContent;
323330
$indices[] = $currentEntry;
324331
$lastToken = $nextToken;

0 commit comments

Comments
 (0)