Magic properties

Hi,

I'm trying to use (well known) magic properties via @property. I have abstract class that uses __get and __set to define magic properties. I want these properties to be visible in all classes that extend the abstract parent class. So I declared these properties using @property doc tag in the abstract class, but auto complete in inheriting classes doesn't work. If I copy the phpdoc block - auto complete is working. I don't want to copy all the @property tags in inheritors. Am I missing something?

2 comments

Hello,

We already have a related request submitted to our tracker here: <https://youtrack.jetbrains.com/issue/WI-19598>. Please vote for it in order to move it up in the queue and receive notifications regarding the progress of the feature. See more information on working with tracker at <https://intellij-support.jetbrains.com/entries/23368682>.

0

I have the feeling WI-19598 is different issue. I'm having troubles replicating the issue. I had something like this:

namespace bug;
/**
* Class ParentClass
* @package bug
*
* @property OtherClassInBug $iExist;
*/
abstract class ParentClass{
protected $magic = [
'iExist' => null,
];

function __get($name) {
return $this->magic[$name];
}

function test() {
echo $this->iExist; // auto-complete works
}


}

namespace different\namespace;


use bug\ParentClass;

class Inheritor extends ParentClass{
public function test() {
$this->iExist; // here auto-complete didn't work
}

}

However, I cleared the IDE caches, then restarted and suddenly it started working as expected... Too bad I couldn't repeat it.

 

BTW, once I paste code directly from the IDE here I can't start writing normal text again. It continues to use "code" formatting

0

Please sign in to leave a comment.