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 - PHP 5.3 try - catch block
Summary: PHP 5.3 try - catch block
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2012-03-11 17:58 UTC by peter90
Modified: 2017-05-02 13:00 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
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.