3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base {} class Sub extends Base{} class NoRelation {} interface I { public function foo(Sub $x); } class CorrectImplementor implements I { public function foo(Base $x) {} // Should be ok } class IncorrectImplementor implements I { public function foo(NoRelation $x) {} // Should be disallowed }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QNhb
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'correctimplementor'
   15     1        DECLARE_CLASS                                            'incorrectimplementor'
   17     2      > RETURN                                                   1

Class Base: [no user functions]
Class Sub: [no user functions]
Class NoRelation: [no user functions]
Class I:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5QNhb
function name:  foo
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function foo

End of class I.

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

End of function foo

End of class CorrectImplementor.

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

End of function foo

End of class IncorrectImplementor.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.17 ms | 1393 KiB | 13 Q