I am currently working in Aptana Studio 3 (which appears to be 3.0.7 at this time) using PHP. I have a function that will return an instance of another object, but that object is determined at run-time. Therefore, it is not possible to decorate the function with relevant comments. Instead, I am looking for a clean solution to decorare the caller with tags for code complete. How can I do this?
/**
* Represents a person.
*/
class Person
{
/**
* Contains the identifier.
*
* @var int
*/
public $PersonId;
/**
* Contains the string.
*
* @var string
*/
public $Name;
}
/**
* A simple factor example.
*
* @return mixed
*/
function CreateExample( $zClass )
{
return new $zClass();
}
/* @var $x Person */
$x = CreateExample( 'Person' ) instanceof Person;
After decoration with both a comment and instanceof, it finally worked, but this looks horrible! Is there no better way to use one solution and make it work as intended?