Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323485

Summary: Adding a new return type which reference to a child class
Product: z_Archived Reporter: Christian Kaps <ck-bugs.eclipse>
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: ganoro, silviya
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
unit test patch none

Description Christian Kaps CLA 2010-08-24 08:48:28 EDT
In the following scenario it isn't possible to get the methods of a child class displayed in the code assist.

<?php

abstract class Member {

    /**
     * @return Member
     */
    public function setStatic($isStatic) {
    
        $this->isStatic = $isStatic;

        return $this;
    }
}

class Property extends Member {

    /**
     * @return Property
     */
    public function setFinal($isFinal) {

        $this->isFinal = $isFinal;

        return $this;
    }
}

$property = new Property;
$property->setStatic(true)
    -> ?;

The entry setFinal() cannot be displayed here because the return type is Member and the Member class has only the method setStatic().

Is it possible to add a self or this return type which refers to the child class(Property)?
Comment 1 Roy Ganor CLA 2010-08-25 08:45:22 EDT
nice request ;) (I think it already exists btw)
Comment 2 Christian Kaps CLA 2010-08-25 13:29:27 EDT
>> nice request ;) (I think it already exists btw)

Exists in PDT?
Comment 3 Roy Ganor CLA 2010-08-26 03:11:56 EDT
I meant the feature request probably exists ;)
Comment 4 xu jiaxi CLA 2010-11-17 01:39:04 EST
Created attachment 183277 [details]
patch

Now you can use "self" to propose the child class
Comment 5 xu jiaxi CLA 2010-11-17 01:39:34 EST
Created attachment 183278 [details]
unit test patch
Comment 6 Zhongwei Zhao CLA 2011-04-28 01:21:25 EDT
updated the patch and applied it to head,thanks!
Comment 7 Sylvia Tancheva CLA 2011-07-26 06:54:42 EDT
Closing
Comment 8 Sylvia Tancheva CLA 2011-07-26 06:55:22 EDT
Using self as return type works