This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235499 - Try/Catch hint when using a method which has a docblock containing @throws
Summary: Try/Catch hint when using a method which has a docblock containing @throws
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-04 11:36 UTC by Caffeine
Modified: 2013-09-04 11:36 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caffeine 2013-09-04 11:36:39 UTC
Would it be possible to have a hint on the left hand side of the editor (where the warning triangles / light bulbs appear) for the following:

class example {

    /**
      *
      * @throws Exception
      */
      public function throwing() {
          throw new Exception();
      }

      public function catch() {
  
(hint wrap this in a try catch)  $this->throwing();
  
      }

}

clicking the hint/light bulb would then create:

try {
    $this->throwing();
} catch ( Exception $e ) {

}

It would be nice if 'Exception' from the above try/catch is populated with the correct exception class from the 'throwing()' method doc block.

A really nice solution would be if multiple @throws are defined then chained catch's would be generated based on the order defined in the doc block:

@throws PDOException
@throws TestException
@throws Exception

try {
    $this->throwing();
} catch ( PDOException $e ) {

} catch ( TestException $e ) {

} catch ( Exception $e ) {

}