Add toString() method for String
This commit is contained in:
parent
27a2d8a3d7
commit
5540bc7607
@ -589,6 +589,11 @@ abstract class AbstractString implements \JsonSerializable
|
||||
return new CodePointString($this->string);
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->string;
|
||||
}
|
||||
|
||||
public function toUnicodeString(): UnicodeString
|
||||
{
|
||||
return new UnicodeString($this->string);
|
||||
|
@ -1370,4 +1370,11 @@ abstract class AbstractAsciiTestCase extends TestCase
|
||||
['fo...', 'foobar', 5, '...'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
{
|
||||
$instance = static::createFromString('foobar');
|
||||
|
||||
self::assertSame('foobar', $instance->toString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user