title: How to prevent PhpStorm from showing an Expected... warning when using PHPUnit mocks?
body: <p>When mocking an interface in PHPUnit, PhpStorm complains when it's used as parameter for a type-hinted function.</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>interface InterfaceA{                                
  
  }                                                    
  
  class ClassA{                                        
      public function foo(InterfaceA $foo){}           
  }                                                    
  
  class PhpStormTest extends PHPUnit_Framework_TestCase
  {                                                    
      public function testFoo(){                       
          $mock = $this-&gt;getMock("InterfaceA");        
          $a = new ClassA();                           
          $a-&gt;foo($mock);                              
      }                                                
  }   
  </code></pre>
  
  <p>On <code>$a-&gt;foo($mock);</code> PhpStorm underlines <code>$mock</code> with the warning <code>Expected InterfaceA, got PHPUnit_Framework_MockObject_MockObject</code></p>
  
  <p><strong>Image</strong></p>
  
  <p><img src="https://i.stack.imgur.com/jP8NH.png" alt="PhpStorm warning when using PHPUnit Mock">                                                                         </p>
  
  <p>I guess it's happening because PHPUnit creates the mock a runtime and PhpStorm cannot know that it's actually implementing the interface. </p>