@@ -884,7 +884,7 @@ private function parseArrayShape(TokenIterator $tokens, Ast\Type\TypeNode $type,
884884 $ done = false ;
885885
886886 do {
887- $ tokens ->skipNewLineTokensAndConsumeComments ();
887+ $ tokens ->skipNewLineTokens ();
888888
889889 if ($ tokens ->tryConsumeTokenType (Lexer::TOKEN_CLOSE_CURLY_BRACKET )) {
890890 return Ast \Type \ArrayShapeNode::createSealed ($ items , $ kind );
@@ -893,7 +893,6 @@ private function parseArrayShape(TokenIterator $tokens, Ast\Type\TypeNode $type,
893893 if ($ tokens ->tryConsumeTokenType (Lexer::TOKEN_VARIADIC )) {
894894 $ sealed = false ;
895895
896- $ tokens ->skipNewLineTokensAndConsumeComments ();
897896 if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_ANGLE_BRACKET )) {
898897 if ($ kind === Ast \Type \ArrayShapeNode::KIND_ARRAY ) {
899898 $ unsealedType = $ this ->parseArrayShapeUnsealedType ($ tokens );
@@ -937,9 +936,6 @@ private function parseArrayShapeItem(TokenIterator $tokens): Ast\Type\ArrayShape
937936 $ startLine = $ tokens ->currentTokenLine ();
938937 $ startIndex = $ tokens ->currentTokenIndex ();
939938
940- // parse any comments above the item
941- $ tokens ->skipNewLineTokensAndConsumeComments ();
942-
943939 try {
944940 $ tokens ->pushSavePoint ();
945941 $ key = $ this ->parseArrayShapeKey ($ tokens );
@@ -977,6 +973,8 @@ private function parseArrayShapeKey(TokenIterator $tokens)
977973 $ startIndex = $ tokens ->currentTokenIndex ();
978974 $ startLine = $ tokens ->currentTokenLine ();
979975
976+ $ tokens ->skipNewLineTokensAndConsumeComments ();
977+
980978 if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_INTEGER )) {
981979 $ key = new Ast \ConstExpr \ConstExprIntegerNode (str_replace ('_ ' , '' , $ tokens ->currentTokenValue ()));
982980 $ tokens ->next ();
0 commit comments