Skip to content

Commit 7b165c7

Browse files
authored
Update the Pluralizer Inflector instanciator (#40336)
Uses the InflectorFactory::createForLanguage function to generate the instance Should make it easier to change to other available languages rulesets such as French, Norwegian Bokmal, Portuguese, Spanish and Turkish
1 parent 84ba139 commit 7b165c7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Illuminate/Support/Pluralizer.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
namespace Illuminate\Support;
44

5-
use Doctrine\Inflector\CachedWordInflector;
5+
use Doctrine\Inflector\InflectorFactory;
66
use Doctrine\Inflector\Inflector;
7-
use Doctrine\Inflector\Rules\English;
87
use Doctrine\Inflector\RulesetInflector;
98

109
class Pluralizer
@@ -136,14 +135,7 @@ public static function inflector()
136135
static $inflector;
137136

138137
if (is_null($inflector)) {
139-
$inflector = new Inflector(
140-
new CachedWordInflector(new RulesetInflector(
141-
English\Rules::getSingularRuleset()
142-
)),
143-
new CachedWordInflector(new RulesetInflector(
144-
English\Rules::getPluralRuleset()
145-
))
146-
);
138+
$inflector = InflectorFactory::createForLanguage('english')->build();
147139
}
148140

149141
return $inflector;

0 commit comments

Comments
 (0)