mirror of
https://github.com/danog/Valinor.git
synced 2024-11-26 20:24:40 +01:00
misc: add singleton usage of ClassStringType
This commit is contained in:
parent
ec494cec48
commit
4bc50e3e42
@ -11,6 +11,7 @@ use CuyZ\Valinor\Type\Type;
|
||||
use CuyZ\Valinor\Type\Types\Exception\CannotCastValue;
|
||||
use CuyZ\Valinor\Type\Types\Exception\InvalidClassString;
|
||||
use CuyZ\Valinor\Type\Types\Exception\InvalidUnionOfClassString;
|
||||
use CuyZ\Valinor\Utility\IsSingleton;
|
||||
use CuyZ\Valinor\Utility\Reflection\Reflection;
|
||||
|
||||
use function is_object;
|
||||
@ -20,6 +21,8 @@ use function method_exists;
|
||||
/** @internal */
|
||||
final class ClassStringType implements StringType, CompositeType
|
||||
{
|
||||
use IsSingleton;
|
||||
|
||||
/** @var ObjectType|UnionType|null */
|
||||
private ?Type $subType;
|
||||
|
||||
|
@ -8,6 +8,7 @@ use CuyZ\Valinor\Tests\Fake\Type\FakeObjectCompositeType;
|
||||
use CuyZ\Valinor\Tests\Fake\Type\FakeObjectType;
|
||||
use CuyZ\Valinor\Tests\Fake\Type\FakeType;
|
||||
use CuyZ\Valinor\Tests\Fixture\Object\StringableObject;
|
||||
use CuyZ\Valinor\Tests\Traits\TestIsSingleton;
|
||||
use CuyZ\Valinor\Type\Types\Exception\InvalidUnionOfClassString;
|
||||
use CuyZ\Valinor\Type\Types\NativeStringType;
|
||||
use CuyZ\Valinor\Type\Types\ClassStringType;
|
||||
@ -24,6 +25,8 @@ use stdClass;
|
||||
|
||||
final class ClassStringTypeTest extends TestCase
|
||||
{
|
||||
use TestIsSingleton;
|
||||
|
||||
public function test_string_subtype_can_be_retrieved(): void
|
||||
{
|
||||
$subType = new FakeObjectType();
|
||||
|
Loading…
Reference in New Issue
Block a user