Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324614 - Eclipse PDT should use namespaces for hinting
Summary: Eclipse PDT should use namespaces for hinting
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-07 01:46 EDT by Timo A. Hummel CLA
Modified: 2020-05-14 11:17 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timo A. Hummel CLA 2010-09-07 01:46:31 EDT
Working example:

<?php
namespace foo;

use bar\Test;

class Test {
	/**
	 * This is just a test.
	 * @return bar\Test The test class
	 */
	public static function getInstance() {
		return new Test;
	}
}
?>

Then type "Test::getInstance()->" and it shows the methods of bar\Test.

This one doesn't:

<?php
namespace foo;

use bar\Test;

class Test {
	/**
	 * This is just a test.
	 * @return Test The test class
	 */
	public static function getInstance() {
		return new Test;
	}
}
?>

Then type "Test::getInstance()->" and itdoesn't show the methods of bar\Test.

The latter should work, since we're using "use bar\Test;" and it should be obvious to PDT that we mean bar\Test, even though we only refer to the alias name.

If this isn't possible for some reason, it would be pretty good if Eclipse would show a warning that it can't resolve "@return Test" when hinting, e.g. when typing "Test::getInstance()->" it should complain that it can't resolve "@return Test", telling the user in which file the phpdoc hint is probably wrong.

-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0520 (org.eclipse.epp.package.php.product)
Installed Features:
 org.eclipse.platform 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY
Comment 1 Zhongwei Zhao CLA 2011-05-19 02:21:00 EDT
fixed in head
Comment 2 Sylvia Tancheva CLA 2011-08-05 09:42:00 EDT
This code works:

<?php
class Test {
    /**
     * This is just a test.
     * @return bar\Test The test class
     */
    public static function getInstance() {
        return new Test;
    }
    
}

type here Test and call the CA and it works, but when add namespace like this:

<?php
namespace foo;

use bar\Test;

class Test {
    /**
     * This is just a test.
     * @return bar\Test The test class
     */
    public static function getInstance() {
        return new Test;
    }
}

and here type the Test and call the CA - nothing happens.


Reopen.
Comment 3 Zhongwei Zhao CLA 2011-08-08 00:49:36 EDT
hi,

When I comment this line,it works
use bar\Test;

After using that line,there should be a bar\Test class/namespace,and then the Test refers to bar\Test instead of foo\Test

So I think this is not a bug.
Comment 4 Sylvia Tancheva CLA 2011-10-20 10:17:49 EDT
Verified. Closing