for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Doctrine\Inflector\Rules;
use function preg_match;
use function preg_replace;
class Rules
{
/** @var Rule[] */
private $rules;
public function __construct(Rule ...$rules)
$this->rules = $rules;
}
public function inflect(string $word) : string
foreach ($this->rules as $rule) {
if (preg_match($rule->getFrom(), $word)) {
return preg_replace($rule->getFrom(), $rule->getTo(), $word);
return $word;