| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 25 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 13 | public function testIfElseIfCreatesVar() | ||
| 14 |     { | ||
| 15 | $context = $this->getContext(); | ||
| 16 | |||
| 17 | $statement = new Node\Stmt\If_( | ||
| 18 | new Node\Expr\BinaryOp\Equal($this->newScalarExpr(1), $this->newScalarExpr(2)), | ||
| 19 | ["elseifs" => | ||
| 20 | [new Node\Stmt\ElseIf_( | ||
| 21 | new Node\Expr\BinaryOp\Equal($this->newScalarExpr(1), $this->newScalarExpr(1)), | ||
| 22 | [new Node\Expr\Assign( | ||
| 23 | new Node\Expr\Variable( | ||
| 24 |                             new Node\Name("stmtTest") | ||
| 25 | ), | ||
| 26 | $this->newScalarExpr(2) | ||
| 27 | )] | ||
| 28 | )] | ||
| 29 | ] | ||
| 30 | ); | ||
| 31 | |||
| 32 | \PHPSA\nodeVisitorFactory($statement, $context); | ||
| 33 | |||
| 34 |         $variable = $context->getSymbol("stmtTest"); | ||
| 35 | |||
| 36 | parent::assertTrue($variable instanceof Variable); | ||
|  | |||
| 37 | } | ||
| 38 | } | ||
| 39 | 
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.