| Conditions | 7 |
| Paths | 4 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | protected function compile($expr, Context $context) |
||
| 28 | { |
||
| 29 | $leftCompiledExpression = $context->getExpressionCompiler()->compile($expr->expr); |
||
|
|
|||
| 30 | $rightCompiledExpression = $context->getExpressionCompiler()->compile($expr->class); |
||
| 31 | |||
| 32 | if ($leftCompiledExpression->isObject() && $rightCompiledExpression->isObject()) { |
||
| 33 | $leftVariable = $leftCompiledExpression->getVariable(); |
||
| 34 | $rightVariable = $rightCompiledExpression->getVariable(); |
||
| 35 | |||
| 36 | /** |
||
| 37 | * $a = new A(); |
||
| 38 | * $b = $a; |
||
| 39 | * |
||
| 40 | * $a instanceof $b |
||
| 41 | */ |
||
| 42 | if ($leftVariable && $rightVariable) { |
||
| 43 | if ($leftVariable->isReferenced() && $leftVariable->getReferencedTo() instanceof $rightVariable) { |
||
| 44 | return new CompiledExpression(CompiledExpression::BOOLEAN, true); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Anyway this operator will return BOOLEAN |
||
| 51 | */ |
||
| 52 | return new CompiledExpression(CompiledExpression::BOOLEAN); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.