Bug Report
| Subject |
Details |
| Rector version |
0.19.0 |
The RemoveAlwaysTrueIfConditionRector tries to remove an if-statement that is needed to prevent access to undefined array keys.
Minimal PHP Code Causing Issue
https://getrector.com/demo/a1bd0aae-6e03-4fe7-b3c5-a6ccbaaff5bc
PHP Warning: Undefined array key "add" in rectorTest.php on line 22 PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in rectorTest.php:22 Stack trace: #0 rectorTest.php(22): array_merge() #1 rectorTest.php(31): Test->test() #2 {main} thrown in rectorTest.php on line 22
Expected Behaviour
There should be no change as the "if" is required.