Skip to content

Commit 582fbde

Browse files
committed
Fix false positive.
1 parent 41b1479 commit 582fbde

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

PhpCollective/Sniffs/Commenting/InlineDocBlockSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected function findErrors(File $phpCsFile, int $contentIndex, bool $isSingle
194194
$comment = $tokens[$contentIndex]['content'];
195195

196196
// SKip for complex arrays until next major
197-
if (str_contains($comment, '<') || str_starts_with($comment, 'array{')) {
197+
if (str_contains($comment, '<') || str_starts_with($comment, 'array{') || str_starts_with($comment, 'object{')) {
198198
return [];
199199
}
200200

tests/_data/InlineDocBlock/after.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ public function test()
2828

2929
/** @var string $foo */
3030
$foo = $_indices['z'];
31+
32+
/** @var object{user_id: int, home_id: int} $row */
33+
$row = new \stdClass();
34+
$user_id = $row->user_id;
3135
}
3236
}

tests/_data/InlineDocBlock/before.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ public function test()
2828

2929
/* @var string $foo */
3030
$foo = $_indices['z'];
31+
32+
/** @var object{user_id: int, home_id: int} $row */
33+
$row = new \stdClass();
34+
$user_id = $row->user_id;
3135
}
3236
}

0 commit comments

Comments
 (0)