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 200773 - @return self to allow return subclass in parent function
Summary: @return self to allow return subclass in parent function
Status: RESOLVED DUPLICATE of bug 196565
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-09 04:45 UTC by RiaD
Modified: 2011-12-05 14:48 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 RiaD 2011-08-09 04:45:00 UTC
First example:

I have some main class, and some subclasses, I have static method to return instance

    class dad{
        public function __construct($arg){
        }

        /**
        * @return self
        */
        public static function get($arg){
            return new static($arg);
        }
    }

    class son exteneds dad{
        public function __construct($arg){
        }

        public function sonFunc(){
            
        }
    }

    class daughter extends dad{
        public function __construct($arg){
        }

        public function daughterFunc(){
            
        }
    }

Now, I want make Netbeans IDE know, that son::get() return son, daughter::get() returns daughter  to correct codecompletion

Other example is chaining:

    class a{
        /**
        * @return self
        */
        public function x(){
            //return $this, it's not always a, it may be subclass
        }   
    }
Comment 1 Ondrej Brejla 2011-12-05 14:48:50 UTC

*** This bug has been marked as a duplicate of bug 196565 ***