Conditions | 1 |
Paths | 1 |
Total Lines | 40 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | public function testModifyReferencedVariables() |
||
11 | { |
||
12 | $context = $this->getContext(); |
||
13 | |||
14 | /** |
||
15 | * This variable is not needed for change |
||
16 | */ |
||
17 | $context->addVariable( |
||
18 | new Variable('a', null, CompiledExpression::INTEGER, 1) |
||
19 | ); |
||
20 | |||
21 | /** |
||
22 | * $b = true; |
||
23 | */ |
||
24 | $context->addVariable( |
||
25 | $variableB = new Variable('b', null, CompiledExpression::BOOLEAN, true) |
||
|
|||
26 | ); |
||
27 | |||
28 | /** |
||
29 | * $c = &$b; |
||
30 | */ |
||
31 | $variableC = new Variable('c'); |
||
32 | $variableC->setReferencedTo($variableB); |
||
33 | |||
34 | $context->addVariable( |
||
35 | $variableC |
||
36 | ); |
||
37 | |||
38 | $newType = CompiledExpression::INTEGER; |
||
39 | $newValue = 55; |
||
40 | |||
41 | /** |
||
42 | * $b = {$newValue}; |
||
43 | * After it variable $c will change type and value |
||
44 | */ |
||
45 | $context->modifyReferencedVariables($variableB, $newType, $newValue); |
||
46 | |||
47 | self::assertSame($newValue, $variableC->getValue()); |
||
48 | self::assertSame($newType, $variableC->getType()); |
||
49 | } |
||
50 | } |
||
51 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: