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 188636 - PEAR style getters and setters generation
Summary: PEAR style getters and setters generation
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 15:48 UTC by admirau
Modified: 2010-08-28 08:06 UTC (History)
1 user (show)

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 admirau 2010-07-13 15:48:10 UTC
When I have private or static member variable,
I declare it with beginning underscore.

private $_test = null;

Then, when I use options to generate getter and setter automatically
(alt+ins)

I get method named: set_test() and get_test()
instead of setTest() and getTest().

Config option to choose naming convention or whether to trim trailing underscore form member variables would be very helpful.
Comment 1 Tomas Mysik 2010-07-14 09:18:20 UTC
Not a defect; I will try to look at it.
Comment 2 maghiel 2010-07-28 14:45:46 UTC
Adding this feature would solve one of my biggest irritatations!
Comment 3 Tomas Mysik 2010-08-19 06:54:12 UTC
Petr fixed this, please verify. Thanks.
http://hg.netbeans.org/web-main?cmd=changeset;node=655a2281499d
Comment 4 admirau 2010-08-28 08:06:37 UTC
Thanks for adding additional option.

This works fine, except the underscore in the variable name should be removed too:

private $_foo;

should be:

public function setFoo($foo) {}

is:

public function setFoo($_foo) {}


It would be nice that Netbeans could generate PHPDoc comments for the setters/getters and corresponding variables too e.g. 

Setter/Getter for {protected/private} variable {@see $_foo}