-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#6685Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/4f18d4d4-73c3-4c41-a163-d9185dcd6b14
<?php
function getList(): array
{
return [];
}
if ($items = getList()) {
echo $items[0];
}Responsible rules
BooleanInIfConditionRuleFixerRector
Expected Behavior
Similar to #8973
The rector converts $items = getList() into $items = getList() !== [].
The issue is, that the precedence is not the same: $items = getList() !== [] is evaluated as $items = (getList() !== []) instead of (expected) ($items = getList()) !== []
see https://3v4l.org/5OQRl for precedence