Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322763 - PHPDoc does not add @throws when using variables
Summary: PHPDoc does not add @throws when using variables
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Q.S. Wang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-16 05:29 EDT by Sylvia Tancheva CLA
Modified: 2020-05-14 11:09 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 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.