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

Bug 322763

Summary: PHPDoc does not add @throws when using variables
Product: z_Archived Reporter: Sylvia Tancheva <silviya>
Component: PDTAssignee: Q.S. Wang <qiangsheng.w>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: gadi, ganoro, qiangsheng.w
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sylvia Tancheva CLA 2010-08-16 05:29:04 EDT
Example code:
function doSomeStuff($header, $footer) {
	if (strlen ( $footer ) < 0) {
		$err= new Exception($header, $code);
		throw $err;
	}
}
Generate Element Comment for this function.
Result:
/**
 * Enter description here ...
 * @param unknown_type $header
 * @param unknown_type $footer
 */

As you can see there is no @throws line.

Replace the code:
$err= new Exception($header, $code);
throw $err;

with:
throw new Exception($header, $code);

The generated comment will be:
/**
 * Enter description here ...
 * @param unknown_type $header
 * @param unknown_type $footer
 * @throws Exception
 */

So in case you use the class directly in the throw statement you get a @throws, otherwise (i.e. use variables) not.
Comment 1 Q.S. Wang CLA 2010-08-19 23:24:00 EDT
Fixed.
Comment 2 Gadi Goldbarg CLA 2010-08-26 03:43:15 EDT
[Petyo Tanchev]

Tested on 2.2.1 SR1
Works as expected.