File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace TypeLang \Printer ;
66
7+ use TypeLang \Parser \Node \Literal \LiteralNode ;
8+ use TypeLang \Parser \Node \Literal \VariableLiteralNode ;
79use TypeLang \Parser \Node \Stmt \CallableTypeNode ;
810use TypeLang \Parser \Node \Stmt \ClassConstMaskNode ;
911use TypeLang \Parser \Node \Stmt \ClassConstNode ;
@@ -189,13 +191,13 @@ protected function printCondition(Condition $node): string
189191 #[\Override]
190192 protected function printClassConstMaskNode (ClassConstMaskNode $ node ): string
191193 {
192- return 'int ' ;
194+ return 'mixed ' ;
193195 }
194196
195197 #[\Override]
196198 protected function printConstMaskNode (ConstMaskNode $ node ): string
197199 {
198- return 'int ' ;
200+ return 'mixed ' ;
199201 }
200202
201203 #[\Override]
@@ -251,4 +253,18 @@ protected function printNamedTypeNode(NamedTypeNode $node): string
251253 {
252254 return $ this ->getTypeName ($ node ->name ->toString ());
253255 }
256+
257+ #[\Override]
258+ protected function printLiteralNode (LiteralNode $ node ): string
259+ {
260+ if ($ node instanceof VariableLiteralNode) {
261+ if ($ node ->getValue () === 'this ' ) {
262+ return 'self ' ;
263+ }
264+
265+ return 'mixed ' ;
266+ }
267+
268+ return parent ::printLiteralNode ($ node );
269+ }
254270}
You can’t perform that action at this time.
0 commit comments