This Question is Answered

2 "helpful" answers available (2 pts)
1 Replies Last post: Feb 9, 2013 9:10 PM by Andriy Bazanov  
Wouter Kampmann Newbie 1 posts since
Feb 9, 2013
Currently Being Moderated

Feb 9, 2013 8:19 PM

Is there a phpdoc tag for telling PhpStorm explicitly a class implements an interface?

I'm writing a "semi-mixin system" for PHP 5.3 (traits are not available). The way this is typically done is by using the magic __call method. I was looking for a way to tell PhpStorm my class implements an interface/other class. I noticed code completion suggest an "@is" doc tag, but is doesn't seem to do anything.


I tried to use it something like this:


*  @is MixinA
*  @is MixinB
class MyClass {
     private $a;
     private $b;
     public function __construct() {
          $this->a = new MixinA();
          $this->b = new MixinB();
     public function __call($name, $args) {
          $callObject = null;
          if (is_callable($this->a, $name)) {
               $callObject = $this->a; 
          } elseif (is_callable($this->b, $name)) {
               $callObject = $this->b; 
          if ($callObject !== null) {
               call_user_func (array($callObject, $name), $args);
class MixinA {
     public function methodA() { ... }
     public function methodB() { ... }
class MixinB {
     public function methodC() { ... };
     public function methodD() { ... };
$object = new MyClass();


Is there a phpdoc tag to do this, and how do I use it? I know I can use @method and @property, but that's too cumbersome since there a lot of methods.


Thanks in advance.

Andriy Bazanov Master 5,110 posts since
May 28, 2010

Hi Wouter,


Unfortunately there is no such tag at all .. and currently no other way except already mentioned @method and @property.


Here is the ticket that asks for such support/implementation in PhpStorm (be it PhpStorm-only supported tag or whatever):

More Like This

  • Retrieving data ...