for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Doctrine\Inflector;
use function array_merge;
use function is_array;
abstract class InflectorService
{
/** @var mixed[] */
protected $rules = [];
/**
* Method cache array.
*
* @var string[][]
*/
protected $cache = [];
public function __construct()
$this->rules = $this->getRules();
}
abstract public function inflect(string $word) : string;
* @return string[][]
abstract public function getRules() : array;
public function reset() : void
$this->cache = [];
* @param mixed[] $rules
public function addRules(array $rules, bool $reset = false) : void
$reset
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function addRules(array $rules, /** @scrutinizer ignore-unused */ bool $reset = false) : void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
//if ($reset) {
$this->reset();
//}
foreach ($rules as $rule => $pattern) {
if (! is_array($pattern)) {
continue;
$this->rules[$rule] = ($rule === 'uninflected')
? array_merge($pattern, $this->rules[$rule])
: $pattern + $this->rules[$rule];
unset($rules[$rule]);
$this->rules['rules'] = $rules + $this->rules['rules'];
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.