for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace GraphQLTests\Doctrine\AttributeBlog\Model\Special;
use Doctrine\ORM\Mapping as ORM;
use GraphQLTests\Doctrine\AttributeBlog\Model\AbstractModel;
#[ORM\Entity]
final class DefaultValue extends AbstractModel
{
#[ORM\Column(type: 'string')]
private string $nameWithDefaultValueOnField = 'jane';
private string $nameWithDefaultValueOnArgumentOverrideField = 'field';
public function setNameWithoutDefault(string $name): void
$name
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function setNameWithoutDefault(/** @scrutinizer ignore-unused */ string $name): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
}
public function setNameWithDefaultValueOnField(string $name): void
$this->nameWithDefaultValueOnField = $name;
public function setNameWithDefaultValueOnArgument(string $name = 'john'): void
public function setNameWithDefaultValueOnArgument(/** @scrutinizer ignore-unused */ string $name = 'john'): void
public function setNameWithDefaultValueOnArgumentOverrideField(string $name = 'argument'): void
$this->nameWithDefaultValueOnArgumentOverrideField = $name;
public function setNameWithDefaultValueOnArgumentNullable(?string $name = null): void
public function setNameWithDefaultValueOnArgumentNullable(/** @scrutinizer ignore-unused */ ?string $name = null): void
public function getNameWithoutDefault(string $name): string
return $name;
public function getNameWithDefaultValueOnArgument(string $name = 'john'): string
public function getNameWithDefaultValueOnArgumentNullable(?string $name = null): string
return $name ?? 'foo';
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.