for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Application\Traits;
use Application\Utility;
use Doctrine\ORM\Mapping as ORM;
/**
* Trait for all objects with a rich text name and an automatic plain version (to sort and filter on).
*/
trait HasRichTextName
{
#[ORM\Column(type: 'string', length: 191)]
private string $name = '';
#[ORM\Column(type: 'string', length: 191, options: ['default' => ''])]
private string $plainName = '';
* @param string $name
public function __construct($name = '')
$this->setName($name);
}
* Set name.
public function setName(string $name): void
$this->name = Utility::sanitizeSingleLineRichText($name);
$this->plainName = Utility::richTextToPlainText($this->name);
* Set plain name.
public function setPlainName(string $plainName): void
$plainName
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function setPlainName(/** @scrutinizer ignore-unused */ string $plainName): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
// Do nothing, plain name is automatically generated from name.
* Get name.
public function getName(): string
return $this->name;
* Get plain name.
public function getPlainName(): string
return $this->plainName;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.