Passed
Push — main ( deaffd...dea3f5 )
by Chema
55s queued 13s
created

FakeController::optionalStringParamAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Router\Fixtures;
6
7
final class FakeController
8
{
9
    public function basicAction(): string
10
    {
11
        return 'Expected!';
12
    }
13
14
    public function stringParamAction(string $param): string
15
    {
16
        $type = get_debug_type($param);
17
        return "The '{$type}' param is '{$param}'!";
18
    }
19
20
    public function optionalStringParamAction(string $param = 'bob'): string
21
    {
22
        $type = get_debug_type($param);
23
        return "The optional '{$type}' param is '{$param}'!";
24
    }
25
26
    public function intParamAction(int $param): string
27
    {
28
        $type = get_debug_type($param);
29
        return "The '{$type}' param is '{$param}'!";
30
    }
31
32
    public function floatParamAction(float $param): string
33
    {
34
        $type = get_debug_type($param);
35
        return "The '{$type}' param is '{$param}'!";
36
    }
37
38
    public function boolParamAction(bool $param): string
39
    {
40
        $type = get_debug_type($param);
41
        $stringParam = json_encode($param);
42
        return "The '{$type}' param is '{$stringParam}'!";
43
    }
44
45
    public function manyParamsAction(string $firstParam, string $secondParam, string $thirdParam): string
46
    {
47
        return "The params are '{$firstParam}', '{$secondParam}' and '{$thirdParam}'!";
48
    }
49
50
    /**
51
     * @param mixed $param
52
     */
53
    public function nonTypedParam($param): string
0 ignored issues
show
Unused Code introduced by
The parameter $param 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

53
    public function nonTypedParam(/** @scrutinizer ignore-unused */ $param): string

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...
54
    {
55
        return 'I AM ERROR!';
56
    }
57
58
    public function nonScalarParam(array $param): string
0 ignored issues
show
Unused Code introduced by
The parameter $param 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

58
    public function nonScalarParam(/** @scrutinizer ignore-unused */ array $param): string

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...
59
    {
60
        return 'I AM ERROR!';
61
    }
62
}
63