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

Bug 323960

Summary: [PHP 5.3] Hover Class aliases -> no tooltip + missing go-to-source
Product: z_Archived Reporter: Sylvia Tancheva <silviya>
Component: PDTAssignee: Zhongwei Zhao <zhaozhongwei>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: ganoro, qiangsheng.w
Version: unspecifiedFlags: ganoro: review+
qiangsheng.w: review+
zhaozhongwei: review? (zhaozhongwei)
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch
none
Alternative none

Description Sylvia Tancheva CLA 2010-08-30 08:10:27 EDT
1. Create a PHP 5.3 project
2. Create 2 php files with the code below.
3. In caller.php file point the "L" in "L\MYCONST" or "L\MyFunction()" -> you get a tooltip showing App\Lib1 (OK)
4. Ctrl+click on the "L" -> App\Lib1 in lib1.php file is selected (OK)
5. Now repeat steps 3 and 4 for "Obj" in "Obj::WhoAmI()" -> no tooltip is shown plus ctrl+click is not available

lib1.php:
=========
<?php
// application library 1
namespace App\Lib1;

const MYCONST = 'App\Lib1\MYCONST';

function MyFunction() {
	return __FUNCTION__;
}

class MyClass {
	static function WhoAmI() {
		return false;
	}
}
?>

caller.php:
============
<?php
use App\Lib1 as L;
use App\Lib1\MyClass as Obj;

require_once('lib1.php');
//require_once('lib2.php');

header('Content-type: text/plain');
echo L\MYCONST . "\n";
echo L\MyFunction() . "\n";
echo Obj::WhoAmI() . "\n";

?>
Comment 1 Zhongwei Zhao CLA 2010-09-05 08:53:00 EDT
Created attachment 178227 [details]
patch
Comment 2 Q.S. Wang CLA 2010-09-05 20:30:39 EDT
I think that there's not need of the if statement. The getRealName should handle the alias/type name already.

I created a new patch.
Comment 3 Q.S. Wang CLA 2010-09-05 20:31:13 EDT
Created attachment 178232 [details]
Alternative
Comment 4 Zhongwei Zhao CLA 2010-09-06 00:35:02 EDT
Hi QS
yes,you are right,thanks,your patch is better than mine.
Comment 5 Zhongwei Zhao CLA 2010-09-06 01:20:00 EDT
fixed
Comment 6 Zhongwei Zhao CLA 2010-09-06 01:20:35 EDT
change status
Comment 7 Zhongwei Zhao CLA 2010-09-13 02:29:25 EDT
the following case does not work
<?php
namespace ns1\n\a;
class CCC{

}

namespace ns1;

use ns1\n as m;

$v = new m\a\CCC();
Comment 8 Zhongwei Zhao CLA 2011-05-19 02:23:04 EDT
fixed in head
Comment 9 Sylvia Tancheva CLA 2011-07-13 09:31:45 EDT
Verified with Studio 9 #179. Closing.

Ilina Stefanova