: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @license https://opensource.org/licenses/mit-license.php MIT License
* Pluralize and singularize English words.
* Inflector pluralizes and singularizes English nouns.
* Used by CakePHP's naming conventions throughout the framework.
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html
protected static $_plural = [
'/(s)tatus$/i' => '\1tatuses',
'/([m|l])ouse$/i' => '\1ice',
'/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
'/(x|ch|ss|sh)$/i' => '\1es',
'/([^aeiouy]|qu)y$/i' => '\1ies',
'/(?:([^f])fe|([lre])f)$/i' => '\1\2ves',
'/(p)erson$/i' => '\1eople',
'/(?<!u)(m)an$/i' => '\1en',
'/(c)hild$/i' => '\1hildren',
'/(buffal|tomat)o$/i' => '\1\2oes',
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin)us$/i' => '\1i',
'/(ax|cris|test)is$/i' => '\1es',
* Singular inflector rules
protected static $_singular = [
'/(s)tatuses$/i' => '\1\2tatus',
'/^(.*)(menu)s$/i' => '\1\2',
'/(quiz)zes$/i' => '\\1',
'/(matr)ices$/i' => '\1ix',
'/(vert|ind)ices$/i' => '\1ex',
'/(alias)(es)*$/i' => '\1',
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
'/([ftw]ax)es/i' => '\1',
'/(cris|ax|test)es$/i' => '\1is',
'/([^a])uses$/' => '\1us',
'/([m|l])ice$/i' => '\1ouse',
'/(x|ch|ss|sh)es$/i' => '\1',
'/(m)ovies$/i' => '\1\2ovie',
'/(s)eries$/i' => '\1\2eries',
'/([^aeiouy]|qu)ies$/i' => '\1y',
'/([le])ves$/i' => '\1f',
'/([^rfoa])ves$/i' => '\1fe',
'/(^analy)ses$/i' => '\1sis',
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
'/(p)eople$/i' => '\1\2erson',
'/(c)hildren$/i' => '\1\2hild',
'/(n)ews$/i' => '\1\2ews',
protected static $_irregular = [
'criterion' => 'criteria',
'ganglion' => 'ganglions',
'graffito' => 'graffiti',
'mongoose' => 'mongooses',
'octopus' => 'octopuses',
'soliloquy' => 'soliloquies',
* Words that should not be inflected
protected static $_uninflected = [
'.*[nrlm]ese', '.*data', '.*deer', '.*fish', '.*measles', '.*ois',
'.*pox', '.*sheep', 'people', 'feedback', 'stadia', '.*?media',
'chassis', 'clippers', 'debris', 'diabetes', 'equipment', 'gallows',
'graffiti', 'headquarters', 'information', 'innings', 'news', 'nexus',
'pokemon', 'proceedings', 'research', 'sea[- ]bass', 'series', 'species', 'weather',
* Default map of accented and special characters to ASCII characters
protected static $_transliteration = [
protected static $_cache = [];
* The initial state of Inflector so reset() works.
protected static $_initialState = [];
* Cache inflected values, and return if already available
* @param string $type Inflection type
* @param string $key Original value
* @param string|false $value Inflected value
* @return string|false Inflected value on cache hit or false on cache miss.
protected static function _cache($type, $key, $value = false)
static::$_cache[$type][$key] = $value;
if (!isset(static::$_cache[$type][$key])) {
return static::$_cache[$type][$key];
* Clears Inflectors inflected value caches. And resets the inflection
* rules to the initial values.
public static function reset()
if (empty(static::$_initialState)) {
static::$_initialState = get_class_vars(__CLASS__);
foreach (static::$_initialState as $key => $val) {
if ($key !== '_initialState') {
* Adds custom inflection $rules, of either 'plural', 'singular',
* 'uninflected', 'irregular' or 'transliteration' $type.
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
* @param string $type The type of inflection, either 'plural', 'singular',
* 'uninflected' or 'transliteration'.
* @param array $rules Array of rules to be added.
* @param bool $reset If true, will unset default inflections for all
* new rules that are being defined in $rules.
public static function rules($type, $rules, $reset = false)
static::${$var} = $rules;
} elseif ($type === 'uninflected') {
static::$_uninflected = array_merge(
static::${$var} = $rules + static::${$var};
* Return $word in plural form.
* @param string $word Word in singular
* @return string Word in plural