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

Add quickfix for missing use block on lambdas #8972

Open
Wilfred opened this issue Jan 28, 2022 · 0 comments
Open

Add quickfix for missing use block on lambdas #8972

Wilfred opened this issue Jan 28, 2022 · 0 comments

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Jan 28, 2022

Example bad code:

function foo(): void {
  $x = 1;
  $f = function() {
    return $x;
  };
}

The quickfix should add the use (if not already present), and the extra variable.

function foo(): void {
  $x = 1;
  $f = function() use ($x) {
    return $x;
  };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant