Skip to content

Commit d9852f6

Browse files
simPodnicolas-grekas
authored andcommitted
Add toString() method for String
1 parent 5374081 commit d9852f6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

AbstractString.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,11 @@ public function toCodePointString(): CodePointString
589589
return new CodePointString($this->string);
590590
}
591591

592+
public function toString(): string
593+
{
594+
return $this->string;
595+
}
596+
592597
public function toUnicodeString(): UnicodeString
593598
{
594599
return new UnicodeString($this->string);

Tests/AbstractAsciiTestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,4 +1370,11 @@ public static function provideTruncate()
13701370
['fo...', 'foobar', 5, '...'],
13711371
];
13721372
}
1373+
1374+
public function testToString()
1375+
{
1376+
$instance = static::createFromString('foobar');
1377+
1378+
self::assertSame('foobar', $instance->toString());
1379+
}
13731380
}

0 commit comments

Comments
 (0)