Skip to content

Commit 8e049b5

Browse files
committed
ClassStructureSniff: Fixed internal error
1 parent 3ee2333 commit 8e049b5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

SlevomatCodingStandard/Sniffs/Classes/ClassStructureSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private function findNextGroup(File $phpcsFile, int $pointer, array $rootScopeTo
275275
$currentTokenPointer = TokenHelper::findNext(
276276
$phpcsFile,
277277
$groupTokenTypes,
278-
$currentToken['scope_closer'] ?? $currentTokenPointer + 1,
278+
($currentToken['scope_closer'] ?? $currentTokenPointer) + 1,
279279
$rootScopeToken['scope_closer']
280280
);
281281
if ($currentTokenPointer === null) {

tests/Sniffs/Classes/data/classStructureSniffNoErrors.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,14 @@ public function notAbtractMethod()
218218
}
219219

220220
}
221+
222+
class WithArrowFunction extends Something
223+
{
224+
225+
public function findBySlug(string $slug)
226+
{
227+
return (new Something())
228+
->first(static fn ($distinction) => $distinction->getSlug() === $slug);
229+
}
230+
231+
}

0 commit comments

Comments
 (0)