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 209439

Summary: PHP 5.3 try - catch block
Product: php Reporter: peter90
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal CC: teelo
Priority: P3    
Version: 7.1.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description peter90 2012-03-11 17:58:56 UTC
In PHP project of version 5.3 it would be great if the "tryc" auto generated code default behaviour will be to write (Exception $exc) as (\Exception $exc) becouse of namespaces.
Comment 1 Xenos 2017-03-09 11:07:22 UTC
You can change the tempate if you want to.

Since "Fix import" will do the right "use", then I don't think this is a real bug to be fixed.

*Maybe* what is to fix would be to change "Exception" for "Throwable", since PHP7 added this new interface as the most-global exception typing?
Comment 2 teelo 2017-05-02 13:00:20 UTC
There actually are two ways of creating the try-catch block: code completion and code template.

The former is IMHO built-in and not modifiable. The latter is modifiable in the code template editor as Xenos pointed out.

Although it's true that you can change the code template you would rather want to use the built-in code completion. Both methods by default do neither use a namespaced class name nor do they create a use statement if necessary.

IMHO: It' pretty uncomfortable the way it is.