Skip to content

Commit ac6925f

Browse files
committed
refactor(ast): use TsProperty constants wherever possible
1 parent 2a5a3c1 commit ac6925f

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/Model/Ast/ConstExpr/ConstExprFalseNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Brainshaker95\PhpToTsBundle\Model\Ast\ConstExpr;
66

77
use Brainshaker95\PhpToTsBundle\Interface\Node;
8+
use Brainshaker95\PhpToTsBundle\Model\TsProperty;
89
use Brainshaker95\PhpToTsBundle\Tool\Assert;
910
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprFalseNode as PHPStanConstExprFalseNode;
1011
use PHPStan\PhpDocParser\Ast\Node as PHPStanNode;
@@ -21,7 +22,7 @@ public function __toString(): string
2122

2223
public function toString(): string
2324
{
24-
return 'false';
25+
return TsProperty::TYPE_FALSE;
2526
}
2627

2728
public static function fromPhpStan(PHPStanNode $node): self

src/Model/Ast/ConstExpr/ConstExprNullNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Brainshaker95\PhpToTsBundle\Model\Ast\ConstExpr;
66

77
use Brainshaker95\PhpToTsBundle\Interface\Node;
8+
use Brainshaker95\PhpToTsBundle\Model\TsProperty;
89
use Brainshaker95\PhpToTsBundle\Tool\Assert;
910
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNullNode as PHPStanConstExprNullNode;
1011
use PHPStan\PhpDocParser\Ast\Node as PHPStanNode;
@@ -21,7 +22,7 @@ public function __toString(): string
2122

2223
public function toString(): string
2324
{
24-
return 'null';
25+
return TsProperty::TYPE_NULL;
2526
}
2627

2728
public static function fromPhpStan(PHPStanNode $node): self

src/Model/Ast/ConstExpr/ConstExprTrueNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Brainshaker95\PhpToTsBundle\Model\Ast\ConstExpr;
66

77
use Brainshaker95\PhpToTsBundle\Interface\Node;
8+
use Brainshaker95\PhpToTsBundle\Model\TsProperty;
89
use Brainshaker95\PhpToTsBundle\Tool\Assert;
910
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprTrueNode as PHPStanConstExprTrueNode;
1011
use PHPStan\PhpDocParser\Ast\Node as PHPStanNode;
@@ -21,7 +22,7 @@ public function __toString(): string
2122

2223
public function toString(): string
2324
{
24-
return 'true';
25+
return TsProperty::TYPE_TRUE;
2526
}
2627

2728
public static function fromPhpStan(PHPStanNode $node): self

src/Model/Ast/Type/NullableTypeNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Brainshaker95\PhpToTsBundle\Model\Ast\Type;
66

77
use Brainshaker95\PhpToTsBundle\Interface\Node;
8+
use Brainshaker95\PhpToTsBundle\Model\TsProperty;
89
use Brainshaker95\PhpToTsBundle\Tool\Assert;
910
use Brainshaker95\PhpToTsBundle\Tool\PhpStan;
1011
use PHPStan\PhpDocParser\Ast\Node as PHPStanNode;
@@ -26,7 +27,7 @@ public function __toString(): string
2627

2728
public function toString(): string
2829
{
29-
return '(' . $this->type . ' | null)';
30+
return '(' . $this->type . ' | ' . TsProperty::TYPE_NULL . ')';
3031
}
3132

3233
public static function fromPhpStan(PHPStanNode $node): self

0 commit comments

Comments
 (0)