Skip to content

Commit c4dabcd

Browse files
committed
Refactor pseudo-types
1 parent 9049757 commit c4dabcd

18 files changed

+42
-32
lines changed

src/Types/ArrayKey.php renamed to src/PseudoTypes/ArrayKey.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
* @link http://phpdoc.org
1212
*/
1313

14-
namespace phpDocumentor\Reflection\Types;
14+
namespace phpDocumentor\Reflection\PseudoTypes;
1515

1616
use phpDocumentor\Reflection\PseudoType;
1717
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\AggregatedType;
19+
use phpDocumentor\Reflection\Types\Compound;
20+
use phpDocumentor\Reflection\Types\Integer;
21+
use phpDocumentor\Reflection\Types\String_;
1822

1923
/**
20-
* Value Object representing a array-key Type.
21-
*
22-
* A array-key Type is the supertype (but not a union) of int and string.
24+
* Value Object representing the type `array-key`.
2325
*
2426
* @psalm-immutable
2527
*/

src/PseudoTypes/ArrayShape.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use phpDocumentor\Reflection\PseudoType;
1717
use phpDocumentor\Reflection\Type;
1818
use phpDocumentor\Reflection\Types\Array_;
19-
use phpDocumentor\Reflection\Types\ArrayKey;
2019
use phpDocumentor\Reflection\Types\Mixed_;
2120

2221
use function implode;

src/PseudoTypes/CallableString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpDocumentor\Reflection\Types\String_;
1919

2020
/**
21-
* Value Object representing the type 'string'.
21+
* Value Object representing the type 'callable-string'.
2222
*
2323
* @psalm-immutable
2424
*/

src/Types/ClassString.php renamed to src/PseudoTypes/ClassString.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
* @link http://phpdoc.org
1212
*/
1313

14-
namespace phpDocumentor\Reflection\Types;
14+
namespace phpDocumentor\Reflection\PseudoTypes;
1515

1616
use phpDocumentor\Reflection\Fqsen;
1717
use phpDocumentor\Reflection\PseudoType;
1818
use phpDocumentor\Reflection\Type;
19+
use phpDocumentor\Reflection\Types\String_;
1920

2021
/**
21-
* Value Object representing the type 'string'.
22+
* Value Object representing the type 'class-string'.
2223
*
2324
* @psalm-immutable
2425
*/

src/PseudoTypes/HtmlEscapedString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpDocumentor\Reflection\Types\String_;
1919

2020
/**
21-
* Value Object representing the type 'string'.
21+
* Value Object representing the type 'html-escaped-string'.
2222
*
2323
* @psalm-immutable
2424
*/

src/Types/InterfaceString.php renamed to src/PseudoTypes/InterfaceString.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
* @link http://phpdoc.org
1212
*/
1313

14-
namespace phpDocumentor\Reflection\Types;
14+
namespace phpDocumentor\Reflection\PseudoTypes;
1515

1616
use phpDocumentor\Reflection\Fqsen;
17+
use phpDocumentor\Reflection\PseudoType;
1718
use phpDocumentor\Reflection\Type;
19+
use phpDocumentor\Reflection\Types\String_;
1820

1921
/**
20-
* Value Object representing the type 'string'.
22+
* Value Object representing the type `interface-string`.
2123
*
2224
* @psalm-immutable
2325
*/
24-
final class InterfaceString implements Type
26+
final class InterfaceString extends String_ implements PseudoType
2527
{
2628
/** @var Fqsen|null */
2729
private $fqsen;
@@ -34,6 +36,11 @@ public function __construct(?Fqsen $fqsen = null)
3436
$this->fqsen = $fqsen;
3537
}
3638

39+
public function underlyingType(): Type
40+
{
41+
return new String_();
42+
}
43+
3744
/**
3845
* Returns the FQSEN associated with this object.
3946
*/

src/PseudoTypes/KeyOf.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use phpDocumentor\Reflection\PseudoType;
1717
use phpDocumentor\Reflection\Type;
18-
use phpDocumentor\Reflection\Types\ArrayKey;
1918

2019
/**
2120
* Value Object representing the `key-of` type.

src/PseudoTypes/LiteralString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpDocumentor\Reflection\Types\String_;
1919

2020
/**
21-
* Value Object representing the type 'string'.
21+
* Value Object representing the type 'literal-string'.
2222
*
2323
* @psalm-immutable
2424
*/

src/PseudoTypes/LowercaseString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpDocumentor\Reflection\Types\String_;
1919

2020
/**
21-
* Value Object representing the type 'string'.
21+
* Value Object representing the type 'lowercase-string'.
2222
*
2323
* @psalm-immutable
2424
*/

src/PseudoTypes/NonEmptyLowercaseString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use phpDocumentor\Reflection\Types\String_;
1919

2020
/**
21-
* Value Object representing the type 'string'.
21+
* Value Object representing the type 'non-empty-lowercase-string'.
2222
*
2323
* @psalm-immutable
2424
*/

0 commit comments

Comments
 (0)