@@ -554,7 +554,11 @@ private function printArrayFormatPreserving(array $nodes, array $originalNodes,
554
554
if (!$ newNode instanceof Node || !$ originalNode instanceof Node) {
555
555
return null ;
556
556
}
557
+
558
+ /** @var int $itemStartPos */
557
559
$ itemStartPos = $ originalNode ->getAttribute (Attribute::START_INDEX );
560
+
561
+ /** @var int $itemEndPos */
558
562
$ itemEndPos = $ originalNode ->getAttribute (Attribute::END_INDEX );
559
563
if ($ itemStartPos < 0 || $ itemEndPos < 0 || $ itemStartPos < $ tokenIndex ) {
560
564
throw new LogicException ();
@@ -617,6 +621,7 @@ private function printArrayFormatPreserving(array $nodes, array $originalNodes,
617
621
continue ;
618
622
}
619
623
624
+ /** @var int $itemEndPos */
620
625
$ itemEndPos = $ tokenIndex - 1 ;
621
626
if ($ insertNewline ) {
622
627
$ result .= $ insertStr . sprintf ('%s%s*%s ' , $ originalTokens ->getDetectedNewline () ?? "\n" , $ beforeAsteriskIndent , $ afterAsteriskIndent );
@@ -642,7 +647,10 @@ private function printArrayFormatPreserving(array $nodes, array $originalNodes,
642
647
return null ;
643
648
}
644
649
650
+ /** @var int $itemStartPos */
645
651
$ itemStartPos = $ originalNode ->getAttribute (Attribute::START_INDEX );
652
+
653
+ /** @var int $itemEndPos */
646
654
$ itemEndPos = $ originalNode ->getAttribute (Attribute::END_INDEX );
647
655
if ($ itemStartPos < 0 || $ itemEndPos < 0 ) {
648
656
throw new LogicException ();
@@ -702,7 +710,7 @@ private function printArrayFormatPreserving(array $nodes, array $originalNodes,
702
710
}
703
711
704
712
/**
705
- * @param Node[] $nodes
713
+ * @param array< Node|null> $nodes
706
714
* @return array{bool, string, string}
707
715
*/
708
716
private function isMultiline (int $ initialIndex , array $ nodes , TokenIterator $ originalTokens ): array
0 commit comments