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

ContextRequireExceptionKeyRule should support non-capturing catches #70

Open
sasezaki opened this issue Nov 10, 2023 · 0 comments
Open
Labels
help wanted Extra attention is needed Improvements 🔧

Comments

@sasezaki
Copy link
Member

sasezaki commented Nov 10, 2023

Also see refs. phpstan/phpstan#8663 ( Catching exception without capturing on PHP 7.4 is not allowed )
https://wiki.php.net/rfc/non-capturing_catches

Currently, would not be detected by ContextRequireExceptionKeyRule below case.

try {
  print 'Lets do something nasty here.';
  throw new Exception('This is nasty');
} catch (Exception) {
  print 'Exception occured';
  $this->logger->error('error happend'); // should be reported as requires \'exception\' key. 

Because, ContextRequireExceptionKeyRule does detects with findCurrentScopeThrowableVariable.

@sasezaki sasezaki added the bug Something isn't working label Nov 10, 2023
@sasezaki sasezaki changed the title ContextRequireExceptionKeyRule should support without capturing ContextRequireExceptionKeyRule should support non-capturing catches Nov 10, 2023
@sasezaki sasezaki added help wanted Extra attention is needed Improvements 🔧 and removed bug Something isn't working labels Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Improvements 🔧
Projects
None yet
Development

No branches or pull requests

1 participant