Skip to content

Commit 15f251a

Browse files
echernyavskiykukulich
authored andcommitted
Reset $annotations keys before determining the last content end pointer
```php var_dump($annotations, $annotations[$annotationsCount - 1]->getEndPointer(), $firstContentEndPointer, $lastContentEndPointer); ``` Before: array(3) { [0] => class SlevomatCodingStandard\Helpers\Annotation#319 (5) { private $name => string(5) "@link" private $startPointer => int(4974) private $endPointer => int(4976) private $parameters => NULL private $content => string(146) "https://github.com/..." } [2] => class SlevomatCodingStandard\Helpers\Annotation#317 (5) { private $name => string(5) "@todo" private $startPointer => int(4984) private $endPointer => int(4986) private $parameters => NULL private $content => string(27) "TODO." } [1] => class SlevomatCodingStandard\Helpers\Annotation#320 (5) { private $name => string(5) "@link" private $startPointer => int(4994) private $endPointer => int(4996) private $parameters => NULL private $content => string(40) "https://..." } } int(4986) int(4969) int(4986) After: array(3) { [0] => class SlevomatCodingStandard\Helpers\Annotation#319 (5) { private $name => string(5) "@link" private $startPointer => int(4974) private $endPointer => int(4976) private $parameters => NULL private $content => string(146) "https://github.com/..." } [1] => class SlevomatCodingStandard\Helpers\Annotation#317 (5) { private $name => string(5) "@todo" private $startPointer => int(4984) private $endPointer => int(4986) private $parameters => NULL private $content => string(27) "TODO." } [2] => class SlevomatCodingStandard\Helpers\Annotation#320 (5) { private $name => string(5) "@link" private $startPointer => int(4994) private $endPointer => int(4996) private $parameters => NULL private $content => string(40) "https://..." } } int(4996) int(4969) int(4996)
1 parent 37cd2ac commit 15f251a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

SlevomatCodingStandard/Sniffs/Commenting/DocCommentSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function process(File $phpcsFile, $docCommentOpenPointer): void
101101
uasort($annotations, function (Annotation $a, Annotation $b): int {
102102
return $a->getStartPointer() <=> $b->getEndPointer();
103103
});
104+
$annotations = array_values($annotations);
104105
$annotationsCount = count($annotations);
105106

106107
$firstAnnotation = $annotationsCount > 0 ? $annotations[0] : null;

0 commit comments

Comments
 (0)