Description
Bug Report
Subject | Details |
---|---|
Rector version | last dev-main |
Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/fc7539a2-8d8c-458a-a974-7ddcefc85e5b
<?php
class Demo {
public function run(?string $maybe, string $part): string
{
$address = $maybe;
$address .= $address ? ' - ' . $part : $part;
return $address;
}
function a(): void {
echo "maybe - part";
echo $this->run('maybe', 'part');
}
function b(): void {
echo "part";
echo $this->run(null, 'part');
}
}
Responsible rules
SimplifyUselessVariableRector
Expected Behavior
Should be: https://3v4l.org/HUZJP
Adapted code by Rector which breaks the business logig: https://3v4l.org/nemWM
The .
operator has precedence over ?: