[String] Fix Notice when argument is empty string

This commit is contained in:
moldman 2020-12-01 17:34:07 +02:00
parent 586f5b72da
commit 88c2b9be62
2 changed files with 13 additions and 0 deletions

View File

@ -305,6 +305,7 @@ final class EnglishInflector implements InflectorInterface
* A list of words which should not be inflected, reversed.
*/
private static $uninflected = [
'',
'atad',
'reed',
'kcabdeef',

View File

@ -306,4 +306,16 @@ class EnglishInflectorTest extends TestCase
{
$this->assertSame(\is_array($plural) ? $plural : [$plural], (new EnglishInflector())->pluralize($singular));
}
public function testPluralizeEmptyString()
{
$plural = (new EnglishInflector())->pluralize('');
$this->assertSame([''], $plural);
}
public function testSingularizeEmptyString()
{
$singular = (new EnglishInflector())->singularize('');
$this->assertSame([''], $singular);
}
}