Passed
Pull Request — master (#63)
by Mark
23:06
created

DefaultValue   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 11
dl 0
loc 44
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getNameWithDefaultValueOnArgument() 0 3 1
A setNameWithDefaultValueOnArgumentOverrideField() 0 3 1
A setNameWithDefaultValueOnArgument() 0 2 1
A getNameWithDefaultValueOnArgumentNullable() 0 3 1
A setNameWithDefaultValueOnArgumentNullable() 0 2 1
A setNameWithoutDefault() 0 2 1
A getNameWithoutDefault() 0 3 1
A setNameWithDefaultValueOnField() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLTests\Doctrine\AttributeBlog\Model\Special;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use GraphQLTests\Doctrine\AttributeBlog\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
    }
22
23
    public function setNameWithDefaultValueOnField(string $name): void
24
    {
25
        $this->nameWithDefaultValueOnField = $name;
26
    }
27
28
    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

28
    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...
29
    {
30
    }
31
32
    public function setNameWithDefaultValueOnArgumentOverrideField(string $name = 'argument'): void
33
    {
34
        $this->nameWithDefaultValueOnArgumentOverrideField = $name;
35
    }
36
37
    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

37
    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...
38
    {
39
    }
40
41
    public function getNameWithoutDefault(string $name): string
42
    {
43
        return $name;
44
    }
45
46
    public function getNameWithDefaultValueOnArgument(string $name = 'john'): string
47
    {
48
        return $name;
49
    }
50
51
    public function getNameWithDefaultValueOnArgumentNullable(?string $name = null): string
52
    {
53
        return $name ?? 'foo';
54
    }
55
}
56