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 153692 - Netbeans seems to not support self
Summary: Netbeans seems to not support self
Status: RESOLVED DUPLICATE of bug 163269
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-22 06:25 UTC by trophaeum
Modified: 2009-08-11 12:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trophaeum 2008-11-22 06:25:05 UTC
class blah {
        static private $instance = null;

        public static function getInstance() {
                if ( self::$instance === null ) {
                        self::$instance = new self;
                }
                return self::$instance;
        }
}

it doesnt understand that new self creates an object of the same type as the object that it is called from.
Comment 1 Tomasz Slota 2008-11-24 17:22:32 UTC
I cannot see any problem with how NB handles specified code. Are you getting unexpected code completion results, error message, ... ? Please describe what 
you mean by "it doesnt understand" and reopen the issue
Comment 2 Mikhail Matveev 2008-11-27 16:56:47 UTC
I see the following problems here:

1)

self::$instance = new se|

can't be completed by CC.

2)

self::$instance = new self

code causes "Class not found" warning (it the warning is turned on).

3)

in code like the following

class MyClass{
    public $testfield;
    public static function myfunc(){
        $obj=new self;
        echo $obj->|;
    }
}    

CC says "No suggestions", 

4)
in the previous example, if I type echo $obj->testfield manually, the IDE gives warning that $obj is unused.
Comment 3 rmatous 2009-08-11 12:26:14 UTC

*** This issue has been marked as a duplicate of 163269 ***