Skip to content

Commit 19c4aae

Browse files
committed
[String] Fix Notice when argument is empty string
1 parent a97573e commit 19c4aae

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Inflector/EnglishInflector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ final class EnglishInflector implements InflectorInterface
305305
* A list of words which should not be inflected, reversed.
306306
*/
307307
private static $uninflected = [
308+
'',
308309
'atad',
309310
'reed',
310311
'kcabdeef',

Tests/EnglishInflectorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,4 +306,16 @@ public function testPluralize(string $singular, $plural)
306306
{
307307
$this->assertSame(\is_array($plural) ? $plural : [$plural], (new EnglishInflector())->pluralize($singular));
308308
}
309+
310+
public function testPluralizeEmptyString()
311+
{
312+
$plural = (new EnglishInflector())->pluralize('');
313+
$this->assertSame([''], $plural);
314+
}
315+
316+
public function testSingularizeEmptyString()
317+
{
318+
$singular = (new EnglishInflector())->singularize('');
319+
$this->assertSame([''], $singular);
320+
}
309321
}

0 commit comments

Comments
 (0)