eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
188 stars 46 forks source link

Variable assignment in return statement is not correctly processed #247

Open flack opened 1 year ago

flack commented 1 year ago

Describe the bug The following functions are identical:

function a() {
    static $cache = null;

    if ($cache === null) {
        $cache = true;
    }
    return $cache;
}

function b() {
    static $cache = null;

    return $cache ??= true;
}

In function b() PDT marks the $cache variable as unused.

Describe the eclipse environment Eclipse 2023-06, PDT 8.1.0.202307051059

Describe your system

To Reproduce see above

Expected behavior There should be no warning

Screenshots

Bildschirmfoto 2023-07-17 um 12 08 54