File tree Expand file tree Collapse file tree 2 files changed +35
-16
lines changed Expand file tree Collapse file tree 2 files changed +35
-16
lines changed Original file line number Diff line number Diff line change 66
77use Symfony \Component \VarDumper \Caster \ReflectionCaster ;
88use Symfony \Component \VarDumper \Cloner \ClonerInterface ;
9- use Symfony \Component \VarDumper \Cloner \Data ;
109use Symfony \Component \VarDumper \Cloner \VarCloner ;
1110use Symfony \Component \VarDumper \Dumper \AbstractDumper ;
1211use Symfony \Component \VarDumper \Dumper \CliDumper ;
1312use Symfony \Component \VarDumper \Dumper \DataDumperInterface ;
1413use TypeLang \Mapper \Exception \Environment \ComposerPackageRequiredException ;
14+ use TypeLang \Mapper \Exception \Value \SymfonyValuePrinter \SimplifiedCliDumper ;
1515
1616final class SymfonyValuePrinter implements ValuePrinterInterface
1717{
@@ -31,21 +31,7 @@ public function __construct(
3131
3232 private function createDefaultDataDumper (): CliDumper
3333 {
34- $ dumper = new class extends CliDumper {
35- public function dump (Data $ data , $ output = null ): ?string
36- {
37- $ result = parent ::dump ($ data , $ output );
38-
39- if ($ result !== null ) {
40- return \rtrim ($ result , "\n" );
41- }
42-
43- return null ;
44- }
45- };
46- $ dumper ->setColors (false );
47-
48- return $ dumper ;
34+ return new SimplifiedCliDumper ();
4935 }
5036
5137 private function createDefaultVarCloner (): VarCloner
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace TypeLang \Mapper \Exception \Value \SymfonyValuePrinter ;
6+
7+ use Symfony \Component \VarDumper \Cloner \Data ;
8+ use Symfony \Component \VarDumper \Dumper \CliDumper ;
9+
10+ /**
11+ * @internal this is an internal library class, please do not use it in your code
12+ * @psalm-internal TypeLang\Mapper\Exception\Value
13+ */
14+ final class SimplifiedCliDumper extends CliDumper
15+ {
16+ public function __construct ($ output = null , ?string $ charset = null , int $ flags = 0 )
17+ {
18+ parent ::__construct ($ output , $ charset , $ flags );
19+
20+ $ this ->setColors (false );
21+ }
22+
23+ public function dump (Data $ data , $ output = null ): ?string
24+ {
25+ $ result = parent ::dump ($ data , $ output );
26+
27+ if ($ result !== null ) {
28+ return \rtrim ($ result , "\n" );
29+ }
30+
31+ return null ;
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments