mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
FPPP: Fall back if comment in list node changes (#420)
This commit is contained in:
parent
cc600b67f6
commit
f6cc85a796
@ -663,6 +663,12 @@ abstract class PrettyPrinterAbstract
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($arrItem->getComments() !== $origArrItem->getComments()) {
|
||||
// Comments changed, fall back
|
||||
// TODO This should only reprint the changed comments
|
||||
return null;
|
||||
}
|
||||
|
||||
$itemStartPos = $origArrItem->getStartTokenPos();
|
||||
$itemEndPos = $origArrItem->getEndTokenPos();
|
||||
if ($itemStartPos < 0 || $itemEndPos < 0) {
|
||||
|
11
test/code/formatPreservation/commentsFallback.test
Normal file
11
test/code/formatPreservation/commentsFallback.test
Normal file
@ -0,0 +1,11 @@
|
||||
Fallback on comment change (for now at least)
|
||||
-----
|
||||
<?php
|
||||
// Test
|
||||
foo();
|
||||
-----
|
||||
$stmts[0]->setAttribute('comments', []);
|
||||
-----
|
||||
<?php
|
||||
|
||||
foo();
|
Loading…
Reference in New Issue
Block a user