Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable assignment in return statement is not correctly processed #247

Open
flack opened this issue Jul 17, 2023 · 0 comments
Open

Variable assignment in return statement is not correctly processed #247

flack opened this issue Jul 17, 2023 · 0 comments
Labels

Comments

@flack
Copy link

flack commented Jul 17, 2023

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

  • macOS 12.6

To Reproduce
see above

Expected behavior
There should be no warning

Screenshots
Bildschirmfoto 2023-07-17 um 12 08 54

@flack flack added the bug label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant