DefaultValue::setNameWithDefaultValueOnField()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLTests\Doctrine\Blog\Model\Special;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use GraphQLTests\Doctrine\Blog\Model\AbstractModel;
9
10
#[ORM\Entity]
11
final class DefaultValue extends AbstractModel
12
{
13
    #[ORM\Column(type: 'string')]
14
    private string $nameWithDefaultValueOnField = 'jane';
15
16
    #[ORM\Column(type: 'string')]
17
    private string $nameWithDefaultValueOnArgumentOverrideField = 'field';
18
19
    public function setNameWithoutDefault(string $name): void {}
0 ignored issues
show
Unused Code introduced by
The parameter $name is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    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.

Loading history...
20
21
    public function setNameWithDefaultValueOnField(string $name): void
22
    {
23
        $this->nameWithDefaultValueOnField = $name;
24
    }
25
26
    public function setNameWithDefaultValueOnArgument(string $name = 'john'): void {}
0 ignored issues
show
Unused Code introduced by
The parameter $name is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

26
    public function setNameWithDefaultValueOnArgument(/** @scrutinizer ignore-unused */ string $name = 'john'): void {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
28
    public function setNameWithDefaultValueOnArgumentOverrideField(string $name = 'argument'): void
29
    {
30
        $this->nameWithDefaultValueOnArgumentOverrideField = $name;
31
    }
32
33
    public function setNameWithDefaultValueOnArgumentNullable(?string $name = null): void {}
0 ignored issues
show
Unused Code introduced by
The parameter $name is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

33
    public function setNameWithDefaultValueOnArgumentNullable(/** @scrutinizer ignore-unused */ ?string $name = null): void {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
35
    public function getNameWithoutDefault(string $name): string
36
    {
37
        return $name;
38
    }
39
40
    public function getNameWithDefaultValueOnArgument(string $name = 'john'): string
41
    {
42
        return $name;
43
    }
44
45
    public function getNameWithDefaultValueOnArgumentNullable(?string $name = null): string
46
    {
47
        return $name ?? 'foo';
48
    }
49
}
50