Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The class implementing the interface must use the exact same method signatures as are defined in the interface. Not doing so will result in a fatal error. And same rules for classes which extends abstract classes.</p> <p>Please, see in <a href="http://php.net/manual/en/language.oop5.interfaces.php" rel="nofollow">see in details here</a>, <a href="http://php.net/manual/en/language.oop5.abstract.php" rel="nofollow">see here too</a></p> <p>And this is right behaviour \ logic.</p> <p><a href="http://en.wikipedia.org/wiki/Abstract_class" rel="nofollow">check here</a> Abstract types are useful in that they can be used to define and enforce a protocol; a set of operations which all objects that implement the protocol must support.</p> <p>if we assume that your code will work without exception, then we have following problem: <code>ConcreteFooMapper</code> can't use instances of some <code>class ConcreteFoo2 implements Foo</code> as parameter for <code>load</code> method, but should (by Abstract class definition)</p> <p>Also, if you use same signature, it not a problem really, cause all class \ type info available. Please, check following code</p> <pre class="lang-php prettyprint-override"><code>&lt;?php interface Foo { public function foo(); } class ConcreteFoo implements Foo { public function foo() { } } abstract class AbstractFooMapper { abstract public function load(Foo $entity, array $data); } class ConcreteFooMapper extends AbstractFooMapper { public function load(Foo $entity, array $data) { var_dump($entity instanceof Foo); var_dump($entity instanceof ConcreteFoo); } } $someConcreteFoo = new ConcreteFoo(); $someFooMapper = new ConcreteFooMapper(); $someFooMapper-&gt;load($someConcreteFoo, array('somekey' =&gt; 'somevalue')); // output // bool(true) bool(true) ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload