title: Why does PHP emit compatibility error when inherited interfaces are used for type hinting?
body: <p>Please take a closer look at the following two code blocks. <strong>Error</strong> and <strong>Warning</strong> produced are placed underneath the respective code block.</p>
  
  <p>It seems very <strong>interesting</strong> to me! I think both should act in the same way, and those should not emit any error or warning as they seems logically valid to me.</p>
  
  <p>Is this a <strong>PHP bug</strong>, or I'm missing something?</p>
  
  <p><em>By the way, I believe the question and the code is very simple and self-explanatory, so I'm not going for further explanation. :-)</em></p>
  
  <pre class="lang-php prettyprint-override"><code>interface A {}
  
  interface B extends A {}
  
  class X implements A {
      public function test() : A {}
  }
  
  class Y extends X implements B {
      public function test() : B {}
  }
  </code></pre>
  
  <p><strong>Fatal error:  Declaration of Y::test(): B must be compatible with X::test(): A</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>interface A {}
  
  interface B extends A {}
  
  class X implements A {
      public function test( A $a ) {}
  }
  
  class Y extends X implements B {
      public function test( B $b ) {}
  }
  </code></pre>
  
  <p><strong>Warning:  Declaration of Y::test(B $b) should be compatible with X::test(A $a</strong></p>