3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooParent {} class FooChild extends FooParent {}; interface BarInterface { public function getProvider(): FooParent; } class BarImplementation { public function getProvider(): FooChild { return new FooChild(); } } $a = new BarImplementation(); var_dump($a->getProvider());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kd0dT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'BarImplementation'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getProvider'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class FooParent: [no user functions]
Class FooChild: [no user functions]
Class BarInterface:
Function getprovider:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kd0dT
function name:  getProvider
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function getprovider

End of class BarInterface.

Class BarImplementation:
Function getprovider:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kd0dT
function name:  getProvider
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'FooChild'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   14     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function getprovider

End of class BarImplementation.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.1 ms | 1436 KiB | 14 Q