Skip to content

Commit

Permalink
Add type definitions support
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Oct 28, 2023
1 parent d50f957 commit 438b833
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions src/NativeTypePrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace TypeLang\Printer;

use TypeLang\Parser\Node\Type\CallableTypeNode;
use TypeLang\Parser\Node\Type\ClassConstMaskNode;
use TypeLang\Parser\Node\Type\ClassConstNode;
use TypeLang\Parser\Node\Type\ConstMaskNode;
use TypeLang\Parser\Node\Type\IntersectionTypeNode;
use TypeLang\Parser\Node\Type\NamedTypeNode;
use TypeLang\Parser\Node\Type\UnionTypeNode;
use TypeLang\Parser\Node\Stmt\CallableTypeNode;
use TypeLang\Parser\Node\Stmt\ClassConstMaskNode;
use TypeLang\Parser\Node\Stmt\ClassConstNode;
use TypeLang\Parser\Node\Stmt\ConstMaskNode;
use TypeLang\Parser\Node\Stmt\IntersectionTypeNode;
use TypeLang\Parser\Node\Stmt\NamedTypeNode;
use TypeLang\Parser\Node\Stmt\UnionTypeNode;

final class NativeTypePrinter extends PrettyPrinter
{
Expand Down
40 changes: 20 additions & 20 deletions src/PrettyPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

use TypeLang\Parser\Node\Node;
use TypeLang\Parser\Node\Literal\LiteralNode;
use TypeLang\Parser\Node\Type\Callable\ArgumentNode;
use TypeLang\Parser\Node\Type\CallableTypeNode;
use TypeLang\Parser\Node\Type\ClassConstMaskNode;
use TypeLang\Parser\Node\Type\ClassConstNode;
use TypeLang\Parser\Node\Type\ConstMaskNode;
use TypeLang\Parser\Node\Type\IntersectionTypeNode;
use TypeLang\Parser\Node\Type\LogicalTypeNode;
use TypeLang\Parser\Node\Type\NamedTypeNode;
use TypeLang\Parser\Node\Type\NullableTypeNode;
use TypeLang\Parser\Node\Type\Shape\FieldNode;
use TypeLang\Parser\Node\Type\Shape\FieldsListNode;
use TypeLang\Parser\Node\Type\Shape\NamedFieldNode;
use TypeLang\Parser\Node\Type\Shape\NumericFieldNode;
use TypeLang\Parser\Node\Stmt\Callable\ArgumentNode;
use TypeLang\Parser\Node\Stmt\CallableTypeNode;
use TypeLang\Parser\Node\Stmt\ClassConstMaskNode;
use TypeLang\Parser\Node\Stmt\ClassConstNode;
use TypeLang\Parser\Node\Stmt\ConstMaskNode;
use TypeLang\Parser\Node\Stmt\IntersectionTypeNode;
use TypeLang\Parser\Node\Stmt\LogicalTypeNode;
use TypeLang\Parser\Node\Stmt\NamedTypeNode;
use TypeLang\Parser\Node\Stmt\NullableTypeNode;
use TypeLang\Parser\Node\Stmt\Shape\FieldNode;
use TypeLang\Parser\Node\Stmt\Shape\FieldsListNode;
use TypeLang\Parser\Node\Stmt\Shape\NamedFieldNode;
use TypeLang\Parser\Node\Stmt\Shape\NumericFieldNode;
use TypeLang\Parser\Node\Statement;
use TypeLang\Parser\Node\Type\Shape\StringNamedFieldNode;
use TypeLang\Parser\Node\Type\Template\ParameterNode;
use TypeLang\Parser\Node\Type\Template\ParametersListNode;
use TypeLang\Parser\Node\Type\TypeStatement;
use TypeLang\Parser\Node\Type\UnionTypeNode;
use TypeLang\Parser\Node\Stmt\Shape\StringNamedFieldNode;
use TypeLang\Parser\Node\Stmt\Template\ArgumentNode;
use TypeLang\Parser\Node\Stmt\Template\ArgumentsListNode;
use TypeLang\Parser\Node\Stmt\TypeStatement;
use TypeLang\Parser\Node\Stmt\UnionTypeNode;
use TypeLang\Parser\Traverser;
use TypeLang\Printer\Exception\NonPrintableNodeException;

Expand Down Expand Up @@ -312,7 +312,7 @@ protected function printNamedTypeNode(NamedTypeNode $node): string
/**
* @return non-empty-string
*/
protected function printTemplateParametersNode(ParametersListNode $params): string
protected function printTemplateParametersNode(ArgumentsListNode $params): string
{
$result = [];

Expand All @@ -327,7 +327,7 @@ protected function printTemplateParametersNode(ParametersListNode $params): stri
/**
* @return non-empty-string
*/
protected function printTemplateParameterNode(ParameterNode $param): string
protected function printTemplateParameterNode(ArgumentNode $param): string
{
return $this->make($param->value);

Check failure on line 332 in src/PrettyPrinter.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, ubuntu-latest)

UndefinedPropertyFetch

src/PrettyPrinter.php:332:28: UndefinedPropertyFetch: Instance property TypeLang\Parser\Node\Stmt\Callable\ArgumentNode::$value is not defined (see https://psalm.dev/039)

Check failure on line 332 in src/PrettyPrinter.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, ubuntu-latest)

MixedArgument

src/PrettyPrinter.php:332:28: MixedArgument: Argument 1 of TypeLang\Printer\PrettyPrinter::make cannot be mixed, expecting TypeLang\Parser\Node\Statement (see https://psalm.dev/030)
}
Expand Down
2 changes: 1 addition & 1 deletion src/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TypeLang\Printer;

use TypeLang\Parser\Node\Statement;
use TypeLang\Parser\Node\Type\LogicalTypeNode;
use TypeLang\Parser\Node\Stmt\LogicalTypeNode;

abstract class Printer implements PrinterInterface
{
Expand Down

0 comments on commit 438b833

Please sign in to comment.