mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-26 20:04:48 +01:00
FPPP: Fix comment indentation (#443)
This commit is contained in:
parent
fa174b093f
commit
336a49b428
@ -1,7 +1,9 @@
|
||||
Version 4.0.0-dev
|
||||
-----------------
|
||||
|
||||
Nothing yet.
|
||||
### Fixed
|
||||
|
||||
* Fixed comment indentation in formatting-preserving pretty printer.
|
||||
|
||||
Version 4.0.0-alpha2 (2017-11-10)
|
||||
---------------------------------
|
||||
|
@ -721,6 +721,9 @@ abstract class PrettyPrinterAbstract
|
||||
continue;
|
||||
}
|
||||
|
||||
$origIndentLevel = $this->indentLevel;
|
||||
$this->setIndentLevel($this->origTokens->getIndentationBefore($itemStartPos) + $indentAdjustment);
|
||||
|
||||
$comments = $arrItem->getComments();
|
||||
$origComments = $origArrItem->getComments();
|
||||
if ($comments !== $origComments) {
|
||||
@ -741,9 +744,6 @@ abstract class PrettyPrinterAbstract
|
||||
} else {
|
||||
$result .= $this->origTokens->getTokenCode($pos, $itemStartPos, $indentAdjustment);
|
||||
}
|
||||
|
||||
$origIndentLevel = $this->indentLevel;
|
||||
$this->setIndentLevel($this->origTokens->getIndentationBefore($itemStartPos) + $indentAdjustment);
|
||||
} else if ($diffType === DiffElem::TYPE_ADD) {
|
||||
if (null === $insertStr) {
|
||||
// We don't have insertion information for this list type
|
||||
|
@ -26,4 +26,27 @@ $foo;
|
||||
|
||||
/* bar */
|
||||
// foo
|
||||
$baz;
|
||||
$baz;
|
||||
-----
|
||||
<?php
|
||||
class Test {
|
||||
/**
|
||||
* @expectedException \FooException
|
||||
*/
|
||||
public function test() {
|
||||
// some code
|
||||
}
|
||||
}
|
||||
-----
|
||||
$method = $stmts[0]->stmts[0];
|
||||
$method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
|
||||
-----
|
||||
<?php
|
||||
class Test {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function test() {
|
||||
// some code
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user