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

PHPStan doesn't detect misspelled function parameter #3023

Closed
mbck24 opened this issue Feb 26, 2020 · 4 comments
Closed

PHPStan doesn't detect misspelled function parameter #3023

mbck24 opened this issue Feb 26, 2020 · 4 comments

Comments

@mbck24
Copy link

mbck24 commented Feb 26, 2020

Bug report

PHPStan version: 0.12.11

example code:

phpstan.org link: https://phpstan.org/r/83b29973-88ba-4531-ab47-8efa22385f60

function doSomething(array $param): void
{
    $fubar = $ppparam['fubar'] ?? [];
    foreach ($fubar as $bar) {
        // do something
    }
}

observed behavior: PHPStan doesn't care about the misspelled parameter variable.

expected behavior: PHPStan should complain about $ppparam as it is never declared but used anyway

Would be really handy if PHPStan would detect that properly. Had some cases were I stumbled upon something like this and the following loops were never entered of course.

thanks,
Martin

@mergeable
Copy link

mergeable bot commented Feb 26, 2020

This bug report is missing a link to reproduction on phpstan.org.
It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

There's already a PR for that: phpstan/phpstan-src#36

@mbck24
Copy link
Author

mbck24 commented Feb 26, 2020

Awesome. Hopefully it can be merged soon.

@lock
Copy link

lock bot commented Apr 2, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants