| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 24 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 13 | public function testIfElseCreatesVar() | ||
| 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 | ["else" => | ||
| 20 | new Node\Stmt\Else_( | ||
| 21 | [new Node\Expr\Assign( | ||
| 22 | new Node\Expr\Variable( | ||
| 23 |                             new Node\Name("stmtTest") | ||
| 24 | ), | ||
| 25 | $this->newScalarExpr(2) | ||
| 26 | )] | ||
| 27 | ) | ||
| 28 | ] | ||
| 29 | ); | ||
| 30 | |||
| 31 | \PHPSA\nodeVisitorFactory($statement, $context); | ||
| 32 | |||
| 33 |         $variable = $context->getSymbol("stmtTest"); | ||
| 34 | |||
| 35 | parent::assertTrue($variable instanceof Variable); | ||
|  | |||
| 36 | } | ||
| 37 | } | ||
| 38 | 
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.