Private variables |
Site Admin
|
I'd recommend you to check php manual http://www.php.net/private Property x in woot class is NOT defined.
it's correct.
it is correct too.
but it is NOT private member. It is UNDEFINED member , or not a member at all. |
||||||||||||||||||||
_________________ The PHP IDE team |
|
So the other points in my post, where the IDE shows $this->x == 1 is wrong? The tooltip and the 'locals' window?
monk.e.boy |
||||||||||||
|
Site Admin
|
Even though debugger showed you that property in the Locals, still it is not accessible from an instance of woot class.
PLEASE check the sample shown in the php manual. It is almost the same as yours and private property gives "not defined" too. It's intended behaviour of php. Nothing else. |
||||||||||||
_________________ The PHP IDE team |
|
I understand how private variables work.
I don't understand why the IDE shows $this->x as 1 and not undefined. We both agree it should be undefined. Why is the IDE telling me it has value '1'? monk.e.boy |
||||||||||||
|
Site Admin
|
It's because this value is in the parent class and debugger sees it. Try to assign $this->x with a value and you'll see _new_ x property created and debugger will show you two properties with the same name x. Debugger just shows you how php works internally.
|
||||||||||||
_________________ The PHP IDE team |
|
> Debugger just shows you how php works internally.
Oh, OK. That makes sense. But from my perspective as a programmer the tooltips, local window and imediate window seem inconsistant. Some show undefined, some show '1'. I think they should all show undefined. monk.e.boy |
||||||||||||
|
Site Admin
|
It's possible. But if we follow your suggestion, it will confuse too. Indeed, same instance will be shown differently in different contexts. While you're in the parent methods, you'll see private properties but as soon as you go out of those methods, private properties will _disappear_. Same goes to the protected properties. They are not accessible out of the class or its successors' scopes.
|
||||||||||||
_________________ The PHP IDE team |
|
That is how other IDEs work. Exactly what you said. They also show the scope of the property, so you may be in 'base' and see "(private) $this->x = 1" and when you pop out into 'woot' that property would dissapear. This is what I would expect to happen I don't think this would confuse people. After all, this is what happens in your head while you are coding. monk.e.boy |
||||||||||||||
|
Private variables |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by