File tree Expand file tree Collapse file tree 10 files changed +35
-84
lines changed
Expand file tree Collapse file tree 10 files changed +35
-84
lines changed Original file line number Diff line number Diff line change 1212namespace PHPCfg \Printer ;
1313
1414use PHPCfg \Func ;
15- use PHPCfg \Printer \Printer ;
1615use PHPCfg \Script ;
1716use phpDocumentor \GraphViz \Edge ;
1817use phpDocumentor \GraphViz \Graph ;
Original file line number Diff line number Diff line change 1212namespace PHPCfg \Printer ;
1313
1414use LogicException ;
15- use PHPCfg \Operand \BoundVariable ;
16- use PHPCfg \Operand \Literal ;
17- use PHPCfg \Operand \NullOperand ;
18- use PHPCfg \Operand \Temporary ;
19- use PHPCfg \Operand \Variable ;
20- use SplObjectStorage ;
21- use SplQueue ;
22- use PHPCfg \Script ;
2315use PHPCfg \Block ;
2416use PHPCfg \Func ;
2517use PHPCfg \Op ;
2618use PHPCfg \Operand ;
27- use PHPCfg \Assertion ;
28- use RecursiveIteratorIterator ;
19+ use PHPCfg \Script ;
2920use RecursiveDirectoryIterator ;
21+ use RecursiveIteratorIterator ;
22+ use SplObjectStorage ;
23+ use SplQueue ;
3024
3125abstract class Printer
3226{
33- const MODE_DEFAULT = 0b00000 ;
34- const MODE_RENDER_ATTRIBUTES = 0b00001 ;
27+ public const MODE_DEFAULT = 0b00000 ;
28+ public const MODE_RENDER_ATTRIBUTES = 0b00001 ;
3529
3630 private SplQueue $ blockQueue ;
3731
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer ;
1313
14- use PHPCfg \Func ;
15- use PHPCfg \Script ;
1614use PHPCfg \Op ;
1715use PHPCfg \Operand ;
18- use PHPCfg \Block ;
1916
2017interface Renderer
2118{
@@ -24,5 +21,5 @@ public function reset(): void;
2421 public function renderOp (Op $ op ): ?array ;
2522
2623 public function renderOperand (Operand $ operand ): ?array ;
27-
28- }
24+
25+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer ;
1313
14- use PHPCfg \Func ;
15- use PHPCfg \Printer \Printer ;
16- use PHPCfg \Script ;
1714use PHPCfg \Op ;
1815use PHPCfg \Operand ;
19- use PHPCfg \Block ;
16+ use PHPCfg \Printer \ Printer ;
2017use PHPCfg \Printer \Renderer ;
2118
2219class GenericOp implements Renderer
2320{
24-
2521 protected Printer $ printer ;
2622
2723 public function __construct (Printer $ printer )
@@ -38,7 +34,7 @@ public function renderOp(Op $op): ?array
3834 'types ' => [],
3935 'vars ' => [],
4036 'attributes ' => $ this ->renderAttributes ($ op ->getAttributes ()),
41- 'childblocks ' => [],
37+ 'childblocks ' => [],
4238 ];
4339
4440 if ($ op instanceof Op \CallableOp) {
@@ -99,7 +95,7 @@ public function renderOp(Op $op): ?array
9995 $ result ['attrGroups ' ] = $ this ->renderAttrGroups ($ op );
10096 }
10197
102-
98+
10399
104100 return $ result ;
105101 }
@@ -110,7 +106,7 @@ public function renderOperand(Operand $operand): ?array
110106 }
111107
112108
113-
109+
114110 protected function renderAttributes (array $ attributes ): array
115111 {
116112 if (!$ this ->printer ->renderAttributes ) {
@@ -183,4 +179,4 @@ protected function renderFlags(Op\Stmt $stmt): string
183179 return $ result ;
184180 }
185181
186- }
182+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Op ;
1313
14-
15- use PHPCfg \Printer \Renderer \GenericOp ;
16- use PHPCfg \Func ;
17- use PHPCfg \Printer \Printer ;
18- use PHPCfg \Script ;
19- use PHPCfg \Op ;
20- use PHPCfg \Operand ;
21- use PHPCfg \Block ;
22- use PHPCfg \Printer \Renderer ;
2314use PHPCfg \Assertion as CoreAssertion ;
15+ use PHPCfg \Op ;
16+ use PHPCfg \Printer \Renderer \GenericOp ;
2417
2518class Assertion extends GenericOp
2619{
@@ -37,7 +30,7 @@ public function renderOp(Op $op): ?array
3730
3831 protected function renderAssertion (CoreAssertion $ assert ): string
3932 {
40-
33+
4134 if (is_array ($ assert ->value )) {
4235 $ combinator = $ assert ->mode === CoreAssertion::MODE_UNION ? '| ' : '& ' ;
4336
@@ -52,4 +45,4 @@ protected function renderAssertion(CoreAssertion $assert): string
5245 return "$ kind( {$ ret }) " ;
5346
5447 }
55- }
48+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Op ;
1313
14-
15- use PHPCfg \Printer \Renderer \GenericOp ;
16- use PHPCfg \Func ;
17- use PHPCfg \Printer \Printer ;
18- use PHPCfg \Script ;
1914use PHPCfg \Op ;
20- use PHPCfg \Operand ;
21- use PHPCfg \Block ;
22- use PHPCfg \Printer \Renderer ;
23- use PHPCfg \Assertion as CoreAssertion ;
15+ use PHPCfg \Printer \Renderer \GenericOp ;
2416
2517class Include_ extends GenericOp
2618{
@@ -50,4 +42,4 @@ public function renderOp(Op $op): ?array
5042 return $ result ;
5143 }
5244
53- }
45+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Op ;
1313
14-
15- use PHPCfg \Printer \Renderer \GenericOp ;
16- use PHPCfg \Func ;
17- use PHPCfg \Printer \Printer ;
18- use PHPCfg \Script ;
1914use PHPCfg \Op ;
20- use PHPCfg \Operand ;
21- use PHPCfg \Block ;
22- use PHPCfg \Printer \Renderer ;
23- use PHPCfg \Assertion as CoreAssertion ;
15+ use PHPCfg \Printer \Renderer \GenericOp ;
2416
2517class TraitUse extends GenericOp
2618{
@@ -73,4 +65,4 @@ public function renderOp(Op $op): ?array
7365 return $ result ;
7466 }
7567
76- }
68+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Operand ;
1313
14- use PHPCfg \Func ;
15- use PHPCfg \Printer \Printer ;
16- use PHPCfg \Script ;
1714use PHPCfg \Op ;
1815use PHPCfg \Operand ;
19- use PHPCfg \Block ;
16+ use PHPCfg \Printer \ Printer ;
2017use PHPCfg \Printer \Renderer ;
2118
2219class Literal implements Renderer
2320{
24-
2521 protected Printer $ printer ;
2622
2723 public function __construct (Printer $ printer )
@@ -52,8 +48,8 @@ public function renderOperand(Operand $operand): ?array
5248 return [
5349 "kind " => "LITERAL " ,
5450 "type " => $ operand ->type ? "< {$ operand ->type }> " : "" ,
55- "value " => var_export ($ operand ->value , true )
51+ "value " => var_export ($ operand ->value , true ),
5652 ];
5753 }
58-
59- }
54+
55+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Operand ;
1313
14- use PHPCfg \Func ;
15- use PHPCfg \Printer \Printer ;
16- use PHPCfg \Script ;
1714use PHPCfg \Op ;
1815use PHPCfg \Operand ;
19- use PHPCfg \Block ;
16+ use PHPCfg \Printer \ Printer ;
2017use PHPCfg \Printer \Renderer ;
2118use SplObjectStorage ;
2219
2320class Temporary implements Renderer
2421{
25-
2622 protected Printer $ printer ;
2723
2824 protected SplObjectStorage $ varIds ;
@@ -35,7 +31,7 @@ public function __construct(Printer $printer)
3531
3632 public function reset (): void
3733 {
38- $ this ->varIds = new SplObjectStorage ;
34+ $ this ->varIds = new SplObjectStorage () ;
3935 }
4036
4137 public function renderOp (Op $ op ): ?array
@@ -64,5 +60,5 @@ protected function getVarId(Operand $var)
6460
6561 return $ this ->varIds [$ var ] = $ this ->varIds ->count () + 1 ;
6662 }
67-
68- }
63+
64+ }
Original file line number Diff line number Diff line change 1111
1212namespace PHPCfg \Printer \Renderer \Operand ;
1313
14- use PHPCfg \Func ;
15- use PHPCfg \Printer \Printer ;
16- use PHPCfg \Script ;
14+ use LogicException ;
1715use PHPCfg \Op ;
1816use PHPCfg \Operand ;
19- use PHPCfg \Block ;
17+ use PHPCfg \Printer \ Printer ;
2018use PHPCfg \Printer \Renderer ;
2119
2220class Variable implements Renderer
2321{
24-
2522 protected Printer $ printer ;
2623
2724 public function __construct (Printer $ printer )
2825 {
2926 $ this ->printer = $ printer ;
3027 }
3128
32- public function reset (): void
33- {}
29+ public function reset (): void {}
3430
3531 public function renderOp (Op $ op ): ?array
3632 {
@@ -64,7 +60,7 @@ public function renderOperand(Operand $operand): ?array
6460 $ prefix = "static $ prefix " ;
6561 break ;
6662 default :
67- throw new \ LogicException ('Unknown bound variable scope ' );
63+ throw new LogicException ('Unknown bound variable scope ' );
6864 }
6965 }
7066
@@ -74,5 +70,5 @@ public function renderOperand(Operand $operand): ?array
7470 "name " => $ prefix . $ operand ->name ->value ,
7571 ];
7672 }
77-
78- }
73+
74+ }
You can’t perform that action at this time.
0 commit comments