3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Test { public function check(Test $x); } interface TestTest extends Test { public function check(Test $x); }; //this is ok: class Foo implements Test { public function check(Test $x) {} } //this is fail, but why? Bar implements Test, so.. logically it fulfills contract.. class Bar implements TestTest { public function check(Test $x) {} }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOmAU
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'testtest'
   15     1        DECLARE_CLASS                                            'foo'
   22     2        DECLARE_CLASS                                            'bar'
   25     3      > RETURN                                                   1

Class Test:
Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOmAU
function name:  check
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function check

End of class Test.

Class TestTest:
Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOmAU
function name:  check
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function check

End of class TestTest.

Class Foo:
Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOmAU
function name:  check
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function check

End of class Foo.

Class Bar:
Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOmAU
function name:  check
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function check

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.14 ms | 1394 KiB | 13 Q