diff --git a/specs/use/use-class.php b/specs/use/use-class.php index a61cbde2..8dea04c4 100644 --- a/specs/use/use-class.php +++ b/specs/use/use-class.php @@ -37,6 +37,7 @@ class Foo {} class Foo { } + use Humbug\Foo; PHP, @@ -56,6 +57,7 @@ class Foo {} class Foo { } + use Humbug\Foo; PHP, diff --git a/specs/use/use-trait.php b/specs/use/use-trait.php index 91cc732e..223efbfc 100644 --- a/specs/use/use-trait.php +++ b/specs/use/use-trait.php @@ -36,8 +36,7 @@ class HTML5DOMDocument { namespace Humbug\IvoPetkov; - class HTML5DOMDocument - { + class HTML5DOMDocument { use \Humbug\IvoPetkov\Internal\QuerySelector; } @@ -60,6 +59,7 @@ class HTML5DOMDocument { namespace Humbug\IvoPetkov; use Humbug\IvoPetkov\Internal\QuerySelector; + class HTML5DOMDocument { use QuerySelector; diff --git a/src/PhpParser/Printer/StandardPrinter.php b/src/PhpParser/Printer/StandardPrinter.php index 7950b859..279abf02 100644 --- a/src/PhpParser/Printer/StandardPrinter.php +++ b/src/PhpParser/Printer/StandardPrinter.php @@ -24,7 +24,11 @@ public function __construct(private PrettyPrinter $decoratedPrinter) public function print(array $newStmts, array $oldStmts, array $oldTokens): string { - $printedStatements = $this->decoratedPrinter->prettyPrintFile($newStmts); + $printedStatements = $this->decoratedPrinter->printFormatPreserving( + $newStmts, + $oldStmts, + $oldTokens, + ); return $printedStatements."\n"; } diff --git a/tests/Scoper/PhpScoperTest.php b/tests/Scoper/PhpScoperTest.php index 65287b9b..8df0c02c 100644 --- a/tests/Scoper/PhpScoperTest.php +++ b/tests/Scoper/PhpScoperTest.php @@ -120,8 +120,6 @@ public function test_can_scope_a_php_file(): void PHP; $expected = <<<'PHP' - #!/usr/bin/env php