Skip to content

Commit

Permalink
Remove needless CallableArrayType and CallableStringType (#30)
Browse files Browse the repository at this point in the history
Since this can be expressed through:
- String callable: `callable&string`
- Static array method: `callable&list{class-string, string}`
- Instance array method: `callable&list{object, string}`

Does it make sense to add factory methods for `callable-string` and
`callable-array` to the `types` ?
These are quite rare types and the chance that someone will ever use
these methods is small.
  • Loading branch information
klimick authored Feb 16, 2024
1 parent b6f4e30 commit 62e5cd7
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 76 deletions.
24 changes: 0 additions & 24 deletions src/CallableArrayType.php

This file was deleted.

24 changes: 0 additions & 24 deletions src/CallableStringType.php

This file was deleted.

6 changes: 0 additions & 6 deletions src/TypeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ public function visitNamedClassString(NamedClassStringType $type): mixed;
/** @return TReturn */
public function visitClassString(ClassStringType $type): mixed;

/** @return TReturn */
public function visitCallableString(CallableStringType $type): mixed;

/** @return TReturn */
public function visitInterfaceString(InterfaceStringType $type): mixed;

Expand Down Expand Up @@ -113,9 +110,6 @@ public function visitArrayShape(ArrayShapeType $type): mixed;
/** @return TReturn */
public function visitNonEmptyArray(NonEmptyArrayType $type): mixed;

/** @return TReturn */
public function visitCallableArray(CallableArrayType $type): mixed;

/** @return TReturn */
public function visitArray(ArrayType $type): mixed;

Expand Down
2 changes: 0 additions & 2 deletions src/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ final class types
public const literalString = AnyLiteralStringType::type;
public const numericString = NumericStringType::type;
public const classString = ClassStringType::type;
public const callableString = CallableStringType::type;
public const interfaceString = InterfaceStringType::type;
public const enumString = EnumStringType::type;
public const traitString = TraitStringType::type;
Expand All @@ -35,7 +34,6 @@ final class types
public const string = StringType::type;
public const numeric = NumericType::type;
public const scalar = ScalarType::type;
public const callableArray = CallableArrayType::type;
public const object = ObjectType::type;
public const resource = ResourceType::type;
public const closedResource = ClosedResourceType::type;
Expand Down
2 changes: 0 additions & 2 deletions tests/PsalmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public static function extractType(Type $_type): mixed
#[TestWith([__DIR__ . '/psalm/ArrayShapeType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ArrayType.phpt'])]
#[TestWith([__DIR__ . '/psalm/BoolType.phpt'])]
#[TestWith([__DIR__ . '/psalm/CallableArrayType.phpt'])]
#[TestWith([__DIR__ . '/psalm/CallableStringType.phpt'])]
#[TestWith([__DIR__ . '/psalm/CallableType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ClassConstantType.phpt'])]
#[TestWith([__DIR__ . '/psalm/ClassStringLiteralType.phpt'])]
Expand Down
9 changes: 0 additions & 9 deletions tests/psalm/CallableArrayType.phpt

This file was deleted.

9 changes: 0 additions & 9 deletions tests/psalm/CallableStringType.phpt

This file was deleted.

0 comments on commit 62e5cd7

Please sign in to comment.