diff --git a/composer.json b/composer.json index fe8c220..48a76be 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "ext-fileinfo": "*", "ext-soap": "*", "nesbot/carbon": "^1.20 || ^2.0", - "doctrine/inflector": "~1.0" + "doctrine/inflector": "^1.4 || ^2.0" }, "require-dev": { "phpunit/phpunit": "^8.5", diff --git a/src/Type.php b/src/Type.php index ec626b7..f66a9b1 100644 --- a/src/Type.php +++ b/src/Type.php @@ -2,7 +2,7 @@ namespace Pace; -use Doctrine\Common\Inflector\Inflector; +use Doctrine\Inflector\InflectorFactory; class Type { @@ -62,6 +62,13 @@ class Type 'FileAttachment' => 'attachment', ]; + /** + * The Doctrine Inflector instance. + * + * @var \Doctrine\Inflector\Inflector|null + */ + protected static $inflector; + /** * Convert a name to camel case. * @@ -92,7 +99,11 @@ public static function modelify($name) */ public static function singularize($name) { - return Inflector::singularize($name); + if (is_null(static::$inflector)) { + static::$inflector = InflectorFactory::create()->build(); + } + + return static::$inflector->singularize($name); } /**