Skip to content

Commit 2118996

Browse files
committed
Printer: fixed indentation of all dumped vars
1 parent 6b873e7 commit 2118996

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

src/PhpGenerator/Printer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public function setTypeResolving(bool $state = true): self
209209

210210
protected function indent(string $s): string
211211
{
212+
$s = str_replace("\t", $this->indentation, $s);
212213
return Strings::indent($s, 1, $this->indentation);
213214
}
214215

src/PhpGenerator/PsrPrinter.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@ final class PsrPrinter extends Printer
2020

2121
/** @var int */
2222
protected $linesBetweenMethods = 1;
23-
24-
25-
protected function dump($var): string
26-
{
27-
return str_replace("\t", $this->indentation, Helpers::dump($var));
28-
}
2923
}

tests/PhpGenerator/Printer.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $class->addMethod('first')
4141
->addComment('@return resource')
4242
->setFinal(true)
4343
->setReturnType('stdClass')
44-
->setBody("func();\nreturn \$this->?;", ['handle'])
44+
->setBody("func();\nreturn ?;", [['aaaaaaaaaaaa' => 1, 'bbbbbbbbbbb' => 2, 'cccccccccccccc' => 3, 'dddddddddddd' => 4, 'eeeeeeeeeeee' => 5]])
4545
->addParameter('var')
4646
->setType('stdClass');
4747

tests/PhpGenerator/PsrPrinter.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $class->addMethod('first')
4040
->addComment('@return resource')
4141
->setFinal(true)
4242
->setReturnType('stdClass')
43-
->setBody("func();\nreturn \$this->?;", ['handle'])
43+
->setBody("func();\nreturn ?;", [['aaaaaaaaaaaa' => 1, 'bbbbbbbbbbb' => 2, 'cccccccccccccc' => 3, 'dddddddddddd' => 4, 'eeeeeeeeeeee' => 5]])
4444
->addParameter('var')
4545
->setType('stdClass');
4646

tests/PhpGenerator/expected/Printer.class.expect

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ final class Example extends ParentClass implements IExample
3939
final public function first(stdClass $var): stdClass
4040
{
4141
func();
42-
return $this->handle;
42+
return [
43+
'aaaaaaaaaaaa' => 1,
44+
'bbbbbbbbbbb' => 2,
45+
'cccccccccccccc' => 3,
46+
'dddddddddddd' => 4,
47+
'eeeeeeeeeeee' => 5,
48+
];
4349
}
4450

4551

tests/PhpGenerator/expected/Printer.method.expect

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
final public function first(stdClass $var): stdClass
55
{
66
func();
7-
return $this->handle;
7+
return [
8+
'aaaaaaaaaaaa' => 1,
9+
'bbbbbbbbbbb' => 2,
10+
'cccccccccccccc' => 3,
11+
'dddddddddddd' => 4,
12+
'eeeeeeeeeeee' => 5,
13+
];
814
}

tests/PhpGenerator/expected/PsrPrinter.class.expect

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ final class Example extends ParentClass implements IExample
3838
final public function first(stdClass $var): stdClass
3939
{
4040
func();
41-
return $this->handle;
41+
return [
42+
'aaaaaaaaaaaa' => 1,
43+
'bbbbbbbbbbb' => 2,
44+
'cccccccccccccc' => 3,
45+
'dddddddddddd' => 4,
46+
'eeeeeeeeeeee' => 5,
47+
];
4248
}
4349

4450
public function second()

0 commit comments

Comments
 (0)