This being my first post, I'd like to say how
impressed I am with PhpED. I've used ZDE for the last 3 years and tried out PhpED about three days ago for the heck of it, and ended up liking it...a lot. It's
responsiveness and smaller memory footprint is very nice, as well as the additional features you get. I'll be purchasing the Professional version here soon.
Now to the problem, explained in comments in the code:
noname1.php
<?php
class Object {
public function __construct($objectId) {
// bleh
}
/**
* Tried with both @return and @returns
*
*
* @returns Object
*/
static public function singleton($objectId) {
static $objects;
if (is_null($objects)) {
$objects = array();
}
if (is_null($objects[$objectId])) {
$objects[$objectId] = new Object($objectId);
}
// tried with and without the following hint
/** @var Object */
return $objects[$objectId];
}
}
?>
|
noname2.php
<?php
class Instance {
/**
* @var Object
*/
public $objectType;
public function __construct($instanceId) {
$this->objectType = Object::singleton(1); // other logic would be in this method to obtain the object type id
$this->objectType-> // code completion fails, however if i use $this->objectType = new Object(1);, completion works
}
}
?>
|
This seems to be an issue with the name of my class being "Object", because if I change the class name to "Objectz" along with the hints, it works great. I've tried this with both classes in the same file and get the same result. I know I could just go ahead and change my class name but I'd really prefer not to.
Anyone run into this before? I wasn't able to find anything regarding this in my forum searches.