3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ParentInterface {} interface ChildInterface extends ParentInterface {} interface OriginalHandlerInterface { public function handle(ParentInterface $a): string; } interface AnotherHandlerInterface { public function handle(ChildInterface $a): string; } class RegularImplementor implements AnotherHandlerInterface { public function handle(ChildInterface $a): string { return class_name($a); } } class ContravariantImplementor implements AnotherHandlerInterface { public function handle(ParentInterface $a): string { return class_name($a); } } class OriginalImplementor implements OriginalHandlerInterface { public function handle(ParentInterface $a) : string { return class_name($a); } } // this will error out class WrongOriginalImplementor implements OriginalHandlerInterface { public function handle(ChildInterface $a) : string { return class_name($a); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'childinterface'
   17     1        DECLARE_CLASS                                            'regularimplementor'
   24     2        DECLARE_CLASS                                            'contravariantimplementor'
   31     3        DECLARE_CLASS                                            'originalimplementor'
   41     4        DECLARE_CLASS                                            'wrongoriginalimplementor'
   47     5      > RETURN                                                   1

Class ParentInterface: [no user functions]
Class ChildInterface: [no user functions]
Class OriginalHandlerInterface:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  handle
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        VERIFY_RETURN_TYPE                                       
          2      > RETURN                                                   null

End of function handle

End of class OriginalHandlerInterface.

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

End of function handle

End of class AnotherHandlerInterface.

Class RegularImplementor:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  handle
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        INIT_FCALL_BY_NAME                                       'class_name'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   21     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function handle

End of class RegularImplementor.

Class ContravariantImplementor:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  handle
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        INIT_FCALL_BY_NAME                                       'class_name'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   28     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function handle

End of class ContravariantImplementor.

Class OriginalImplementor:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  handle
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   35     1        INIT_FCALL_BY_NAME                                       'class_name'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   36     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function handle

End of class OriginalImplementor.

Class WrongOriginalImplementor:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sZ9XB
function name:  handle
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
   45     1        INIT_FCALL_BY_NAME                                       'class_name'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   46     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function handle

End of class WrongOriginalImplementor.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.7 ms | 1399 KiB | 13 Q