Skip to content

Commit

Permalink
Renamed LiteralIntType to AnyLiteralIntType and LiteralStringType to …
Browse files Browse the repository at this point in the history
…AnyLiteralStringType (#28)
  • Loading branch information
vudaltsov authored Feb 7, 2024
1 parent 5fbfd03 commit b6f4e30
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/LiteralIntType.php → src/AnyLiteralIntType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @psalm-immutable
* @implements Type<literal-int>
*/
enum LiteralIntType implements Type
enum AnyLiteralIntType implements Type
{
/**
* @internal
Expand All @@ -19,6 +19,6 @@ enum LiteralIntType implements Type

public function accept(TypeVisitor $visitor): mixed
{
return $visitor->visitLiteralInt($this);
return $visitor->visitAnyLiteralInt($this);
}
}
4 changes: 2 additions & 2 deletions src/LiteralStringType.php → src/AnyLiteralStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @psalm-immutable
* @implements Type<literal-string>
*/
enum LiteralStringType implements Type
enum AnyLiteralStringType implements Type
{
/**
* @internal
Expand All @@ -19,6 +19,6 @@ enum LiteralStringType implements Type

public function accept(TypeVisitor $visitor): mixed
{
return $visitor->visitLiteralString($this);
return $visitor->visitAnyLiteralString($this);
}
}
4 changes: 2 additions & 2 deletions src/TypeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function visitBool(BoolType $type): mixed;
public function visitIntLiteral(IntLiteralType $type): mixed;

/** @return TReturn */
public function visitLiteralInt(LiteralIntType $type): mixed;
public function visitAnyLiteralInt(AnyLiteralIntType $type): mixed;

/** @return TReturn */
public function visitIntRange(IntRangeType $type): mixed;
Expand All @@ -57,7 +57,7 @@ public function visitFloat(FloatType $type): mixed;
public function visitStringLiteral(StringLiteralType $type): mixed;

/** @return TReturn */
public function visitLiteralString(LiteralStringType $type): mixed;
public function visitAnyLiteralString(AnyLiteralStringType $type): mixed;

/** @return TReturn */
public function visitNumericString(NumericStringType $type): mixed;
Expand Down
4 changes: 2 additions & 2 deletions src/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ final class types
public const false = FalseType::type;
public const true = TrueType::type;
public const bool = BoolType::type;
public const literalInt = LiteralIntType::type;
public const literalInt = AnyLiteralIntType::type;
public const int = IntType::type;
public const positiveInt = __positiveInt;
public const negativeInt = __negativeInt;
public const nonPositiveInt = __nonPositiveInt;
public const nonNegativeInt = __nonNegativeInt;
public const float = FloatType::type;
public const literalString = LiteralStringType::type;
public const literalString = AnyLiteralStringType::type;
public const numericString = NumericStringType::type;
public const classString = ClassStringType::type;
public const callableString = CallableStringType::type;
Expand Down
4 changes: 2 additions & 2 deletions tests/PsalmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static function extractType(Type $_type): mixed
return null;
}

#[TestWith([__DIR__ . '/psalm/AnyLiteralIntType.phpt'])]
#[TestWith([__DIR__ . '/psalm/AnyLiteralStringType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ArrayKeyType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ArrayShapeType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ArrayType.phpt'])]
Expand Down Expand Up @@ -52,8 +54,6 @@ public static function extractType(Type $_type): mixed
#[TestWith([__DIR__ . '/psalm/IterableType.phpt'])]
#[TestWith([__DIR__ . '/psalm/KeyOfType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ListType.phpt'])]
#[TestWith([__DIR__ . '/psalm/LiteralIntType.phpt'])]
#[TestWith([__DIR__ . '/psalm/LiteralStringType.phpt'])]
#[TestWith([__DIR__ . '/psalm/MixedType.phpt'])]
#[TestWith([__DIR__ . '/psalm/NamedClassStringType.phpt'])]
#[TestWith([__DIR__ . '/psalm/NamedObjectType.phpt'])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Typhoon\Type;

$_type = PsalmTest::extractType(LiteralIntType::type);
$_type = PsalmTest::extractType(AnyLiteralIntType::type);
/** @psalm-check-type-exact $_type = \literal-int */

--EXPECT--
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Typhoon\Type;

$_type = PsalmTest::extractType(LiteralStringType::type);
$_type = PsalmTest::extractType(AnyLiteralStringType::type);
/** @psalm-check-type-exact $_type = \literal-string */

--EXPECT--

0 comments on commit b6f4e30

Please sign in to comment.