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

Bug 362672

Summary: Support PHP 5.4 syntax
Product: z_Archived Reporter: Roy Ganor <ganoro>
Component: PDTAssignee: PHP UI <php.ui-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: chriscunningham0, jacek.pospychala, kristianoye, silviya
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2008   
Whiteboard:

Description Roy Ganor CLA 2011-11-02 09:39:15 EDT
The PHP team has released the 5.4 beta #2 
http://www.php.net/archive/2011.php#id2011-10-26-1

It's time for us to enable the community to develop applications based on it
Comment 2 Kris Oye CLA 2011-11-19 13:00:15 EST
I am really looking forward to using the new PHP 5.4 features like the shortened array syntax, traits, and chaining on the constructor.  I know it's early still, but any estimates on when PDT will support the new syntax?
Comment 3 Roy Ganor CLA 2012-02-01 04:14:36 EST
stubs created.
Comment 4 Chris Cunningham CLA 2012-03-06 05:51:56 EST
Yep I agree with this it would be great to have an update for 5.4 syntax

I would like to see something like this if possible

<?php
// File 1 Traits.php

trait singleton 
{
    private static $oInstance = null;
    
    public static function getSingleton() {
        if(!self::$oInstance instanceof self) {
            self::$oInstance = new self;
        }
        return self::$oInstance;
        
    }
}

// File 2 NewClass.php

require_once 'Traits.php';
    
class NewClass 
{   
    /**
     * @var NewClass
     * @return NewClass
     */
    use singleton;
        
    public function display() {
        echo get_class($this);
    }
        
    protected function doSomething() {
        // Would be nice for the definition of @var NewClass above
        // to allow Ctrl space to show available instance methods 
        // on self::$oInstance->
        self::$oInstance->display();   
    }       
}
    
NewClass::singleton()->display();
    
// It would be great to be able to see available static trait
// methods when pressing Ctrl space after typing NewClass::

// Also available instance methods after typing NewClass::singleton()->
Comment 5 Zhongwei Zhao CLA 2012-07-23 01:01:50 EDT
fixed
Comment 6 Zhongwei Zhao CLA 2012-07-23 23:11:54 EDT
reopened it,since the issue mentioned comment 4 has not been fixed yet ,and lots of php 5.4 new changes are not fixed.
Comment 7 Zhongwei Zhao CLA 2012-07-23 23:12:26 EDT
reopen it...
Comment 8 Chris Cunningham CLA 2012-07-24 03:19:58 EDT
Nice one Zhongwei... glad you reopened this bug report...

I tested this last night after I noticed you marked this as fixed but I couldn't get it to work... so I thought I was missing something.

I also noticed that I made a copy error with the function name singleton it should have read getSingleton in the function call examples like so. 

NewClass::getSingleton()->display();

Looking forward to the fix updates

Thanks
Comment 9 Jacek Pospychala CLA 2012-07-24 06:59:02 EDT
Sorry Chris, that we didn't added this yet.
Let's keep this bug just for updating parser to 5.4 syntax.
I opened separate bug for improvements in Content Assist - see bug 385837
Comment 10 Jacek Pospychala CLA 2012-07-24 06:59:47 EDT
marking as fixed
Comment 11 Chris Cunningham CLA 2012-07-24 17:09:21 EDT
Hey Jacek,

Sure that makes sense to create a separate bug for 5.4 syntax. 

No problem thanks to you all... great stuff guys...
Comment 12 Sylvia Tancheva CLA 2012-08-09 10:10:31 EDT
Verified. Closing according to Jacek's comment: "Let's keep this bug just for updating parser to 5.4 syntax."

Ilina Stefanova