Completed
Pull Request — master (#194)
by Enrico
07:43
created

ElseSt::compile()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.0175

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 2
dl 0
loc 10
ccs 7
cts 8
cp 0.875
crap 3.0175
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PHPSA\Compiler\Statement;
4
5
use PHPSA\CompiledExpression;
6
use PHPSA\Context;
7
8
class ElseSt extends AbstractCompiler
9
{
10
    protected $name = '\PhpParser\Node\Stmt\Else_';
11
12
    /**
13
     * @param \PhpParser\Node\Stmt\Else_ $statement
0 ignored issues
show
Documentation introduced by
There is no parameter named $statement. Did you maybe mean $elseStatement?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
14
     * @param Context $context
15
     */
16 2
    public function compile($elseStatement, Context $context)
17
    {
18 2
        if (count($elseStatement->stmts) > 0) {
19 2
            foreach ($elseStatement->stmts as $stmt) {
20 2
                \PHPSA\nodeVisitorFactory($stmt, $context);
21 2
            }
22 2
        } else {
23
            $context->notice('not-implemented-body', 'Missing body', $elseStatement);
24
        }
25 2
    }
26
}
27