Completed
Push — master ( b64f8f...06557d )
by Tobias
02:24
created

TestController::foo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
4
namespace App\Controller\Test;
5
6
7
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
9
class TestController extends Controller
10
{
11
    public function foo()
12
    {
13
        $foo = [
0 ignored issues
show
Unused Code introduced by
$foo is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
14
            ['label' => $this->get('translator')->trans('this.should.be.translated.without.errors')], //ERROR: Form label is not a scalar string
15
            [/** @Ignore */'label' => $this->get('translator')->trans('this.should.be.translated.without.errors.and.now.it.works')],
16
            ['label_' => $this->get('translator')->trans('this.works.correctly')],
17
            ['label' => $this->shouldBeIgnored()], //ERROR: Form label is not a scalar string
18
            [/** @Ignore */'label' => $this->shouldBeIgnoredAndGoesWithoutError()],
19
        ];
20
    }
21
22
    private function shouldBeIgnored()
23
    {
24
    }
25
26
    private function shouldBeIgnoredAndGoesWithoutError()
27
    {
28
    }
29
}
30