Skip to content

Commit 7e14184

Browse files
committed
remove comments to the right stuff
1 parent 8c22c85 commit 7e14184

File tree

3 files changed

+2
-52
lines changed

3 files changed

+2
-52
lines changed

src/Parser/TypeParser.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,11 +846,6 @@ private function parseArrayShapeItem(TokenIterator $tokens): Ast\Type\ArrayShape
846846
$tokens->consumeTokenType(Lexer::TOKEN_COLON);
847847
$value = $this->parse($tokens);
848848

849-
// parse comment to the right of the item
850-
if ($tokens->currentTokenType() === Lexer::TOKEN_COMMENT) {
851-
$comments[] = new Ast\Comment($tokens->currentTokenValue(), $tokens->currentTokenLine(), $tokens->currentTokenIndex());
852-
$tokens->next();
853-
}
854849
$tokens->dropSavePoint();
855850

856851
return $this->enrichWithAttributes(

tests/PHPStan/Parser/TypeParserTest.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -162,51 +162,6 @@ public function provideParseData(): array
162162
),
163163
]),
164164
],
165-
[
166-
'array{
167-
a: int, // a is for after,
168-
}',
169-
new ArrayShapeNode([
170-
new ArrayShapeItemNode(
171-
new IdentifierTypeNode('a'),
172-
false,
173-
new IdentifierTypeNode('int')
174-
),
175-
]),
176-
],
177-
[
178-
'array{
179-
// you can never have
180-
a: int, // too many comments
181-
}',
182-
new ArrayShapeNode([
183-
new ArrayShapeItemNode(
184-
new IdentifierTypeNode('a'),
185-
false,
186-
new IdentifierTypeNode('int')
187-
),
188-
]),
189-
],
190-
[
191-
'array{
192-
a: int, // a is for after,
193-
b: string, /* b is for banana,
194-
* which is good to know
195-
*/
196-
}',
197-
new ArrayShapeNode([
198-
new ArrayShapeItemNode(
199-
new IdentifierTypeNode('a'),
200-
false,
201-
new IdentifierTypeNode('int')
202-
),
203-
new ArrayShapeItemNode(
204-
new IdentifierTypeNode('b'),
205-
false,
206-
new IdentifierTypeNode('string')
207-
),
208-
]),
209-
],
210165
[
211166
'array{
212167
/* a is also for aardvark */

tests/PHPStan/Printer/PrinterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ public function enterNode(Node $node)
664664

665665
};
666666

667-
$addSingleLineCommentsToMultilineArrayShape = new class extends AbstractNodeVisitor {
667+
$addCommentsToMultilineArrayShape = new class extends AbstractNodeVisitor {
668668

669669
public function enterNode(Node $node)
670670
{
@@ -725,7 +725,7 @@ public function enterNode(Node $node)
725725
* e: string
726726
* }
727727
*/',
728-
$addSingleLineCommentsToMultilineArrayShape,
728+
$addCommentsToMultilineArrayShape,
729729
];
730730

731731

0 commit comments

Comments
 (0)