Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323485 - Adding a new return type which reference to a child class
Summary: Adding a new return type which reference to a child class
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-24 08:48 EDT by Christian Kaps CLA
Modified: 2020-05-14 11:08 EDT (History)
2 users (show)

See Also:


Attachments
patch (2.69 KB, patch)
2010-11-17 01:39 EST, xu jiaxi CLA
no flags Details | Diff
unit test patch (1.08 KB, patch)
2010-11-17 01:39 EST, xu jiaxi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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