Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315681 - code assisting in a catch statement does not take in account namespaces
Summary: code assisting in a catch statement does not take in account namespaces
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Server 2003
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 17:28 EDT by aikeleer CLA
Modified: 2020-05-14 11:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aikeleer CLA 2010-06-03 17:28:56 EDT
Build Identifier: 20100527-0614

When coding inside a Namespace and using a try{ } catch-block, code assist forgets my namespace. 

Reproducible: Always

Steps to Reproduce:
For example:
namespace foo;

This should be suggested at the catch phrase:
try
{
{
catch(\Exception $e)
{
}

But this is suggested:
try
{
}
catch(Exception $e)
{
}

While this results in a fatal error.
Comment 1 Zhongwei Zhao CLA 2010-06-03 21:15:22 EDT
Hi

Can you describe the steps to reproduce this,for example

1.have the following content in php
{
}
catch(\Exception| $e)//cursor
{
}

2 calll CA
3 Results in a fatal error.


Thanks
Comment 2 Zhongwei Zhao CLA 2010-06-03 23:20:08 EDT
Hi

I guess when you run the code you get fatal error ,right?
Comment 3 aikeleer CLA 2010-06-04 15:40:09 EDT
Example code:

This is a working version:
<?php

namespace example;

class Bla
{
	function __construct()
	{
		try
		{
			// something which throws an Exception
		}
		catch(\Exception $e)
		{
			echo "bla";
		}
	}
}
$bla = new Bla();

?>

Now for the Assist functionality:

I type
<?php

namespace exmaple;

class Bla
{
function __construct()
{
try
{
// function which throws exception
}
catch ([CURSOR, now type ctrl+space, choose Exception, press Enter]

The suggestion puts a normal 'Exception' there, while it should be a '\Exception'.

I really hope this is a bit more clear. :)
Comment 4 Zhongwei Zhao CLA 2011-05-17 02:45:40 EDT
fixed in head
Comment 5 Zhongwei Zhao CLA 2011-06-14 23:56:41 EDT
reopen it,because now it only works for the code:
<?php

namespace exmaple;

class Bla
{
function __construct()
{
try
{
// function which throws exception
}
catch ([CURSOR, now type ctrl+space, choose Exception, press Enter] $e){
         
      }
   }
}

?>
Comment 6 Dawid Pakula CLA 2014-06-02 04:59:27 EDT
This works correctly with 3.3.0
Comment 7 Sylvia Tancheva CLA 2015-05-29 11:29:50 EDT
Verified. Closing