Skip to content

ContextRequireExceptionKeyRule should support non-capturing catches #70

@sasezaki

Description

@sasezaki

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions