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

Bug 321880

Summary: [PHP 5.3] Content Assist does not suggest class alias
Product: z_Archived Reporter: Kalin <kalin.a>
Component: PDTAssignee: Zhongwei Zhao <zhaozhongwei>
Status: CLOSED FIXED QA Contact: Ilina Stefanova <ilina.s>
Severity: normal    
Priority: P1 CC: ganoro, qiangsheng.w, silviya, zhaozhongwei
Version: unspecifiedFlags: zhaozhongwei: review? (ganoro)
qiangsheng.w: review-
zhaozhongwei: review? (zhaozhongwei)
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Kalin CLA 2010-08-05 10:04:56 EDT
Build Identifier: 2.2.0.v20100621

Have the following code in file1.php under 5.3 project:
<?php
namespace ns;
class CCC{
	
}

Have the following code file2.php under same project:

<?php
use ns\CCC as MyTest;

$rt = new MyTe| // invoke code assist at cursor position |


Actual:
No completion available.

Actual:
MyTest should be suggested.


Reproducible: Always
Comment 1 Roy Ganor CLA 2010-08-06 06:29:44 EDT
let's discuss how to fix this important issue
Comment 2 Zhongwei Zhao CLA 2010-08-06 10:19:21 EDT
Hi QS

have done something for this bug,if not,would you mind let me do it?
Comment 3 Zhongwei Zhao CLA 2010-08-30 03:08:28 EDT
add MyTest to h2....PHPSourceElementRequestor,PhpIndexingVisitor
Comment 4 Zhongwei Zhao CLA 2010-09-07 03:15:57 EDT
Created attachment 178298 [details]
patch
Comment 5 Q.S. Wang CLA 2010-09-13 01:26:12 EDT
For the following code, the CA works all right after patching. However the tool tip, go to source is not working for MyTest();

<?php
namespace ns1\n;
class CCC{

}

namespace ns1;

use n\CCC as MyTest;
class MyT{
}

$rt = new MyTest();
Comment 6 Zhongwei Zhao CLA 2010-09-13 02:03:19 EDT
I think
use n\CCC as MyTest;
should be 
use ns1\n\CCC as MyTest;

because it is said that:
 the leading backslash is unnecessary and not allowed, as import names must be fully qualified, and are not processed relative to the current namespace.
Comment 7 Q.S. Wang CLA 2010-09-13 02:20:39 EDT
You can be correct. I'm not the expert of PHP namesapce. 

I tried some other cases by following your comments.Do you think the following case is valid? 

<?php
namespace ns1\n\a;
class CCC{

}

namespace ns1;

use ns1\n as m;

$v = new m\a\CCC();
Comment 8 Zhongwei Zhao CLA 2010-09-13 02:30:15 EDT
I think it is right,and go to source does not work for it.And I think it belongs to bug 323960,and I reopened it.
Comment 9 Q.S. Wang CLA 2010-09-13 03:51:14 EDT
I think the CA has issue as well.

$v = new m\| // CA here. I think the proposal should show the m\a\...?
Comment 10 Zhongwei Zhao CLA 2010-09-13 04:09:46 EDT
hi QS

I think you are right!
Comment 11 Zhongwei Zhao CLA 2011-05-15 23:09:31 EDT
*** Bug 268312 has been marked as a duplicate of this bug. ***
Comment 12 Zhongwei Zhao CLA 2011-05-19 02:21:26 EDT
fixed in head
Comment 13 Ilina Stefanova CLA 2011-07-25 07:38:26 EDT
The description code is not working as expected. Reopen ...
Comment 14 Zhongwei Zhao CLA 2011-08-07 23:43:43 EDT
fixed
Comment 15 Kalin CLA 2011-10-17 09:48:07 EDT
Verified.
Closing...