3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo($x): B { return new B; } } class B extends A { public function foo($x): C { return new C; } } class C extends B { } (new C)->foo('blah');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bHiF
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                            'b', 'a'
   16     1        DECLARE_CLASS                                            'c', 'b'
   19     2        NEW                                              $0      'C'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $0, 'foo'
          5        SEND_VAL_EX                                              'blah'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bHiF
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        NEW                                              $1      'B'
          2        DO_FCALL                                      0          
          3        VERIFY_RETURN_TYPE                                       $1
          4      > RETURN                                                   $1
    7     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bHiF
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        NEW                                              $1      'C'
          2        DO_FCALL                                      0          
          3        VERIFY_RETURN_TYPE                                       $1
          4      > RETURN                                                   $1
   13     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function foo

End of class B.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.31 ms | 1394 KiB | 13 Q