3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test { public static function factory() : object { return new static(); } } class Test2 extends Test { public static function factory() : static { return parent::factory(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lp3AB
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                       1

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

End of function factory

End of class Test.

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

End of function factory

End of class Test2.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.12 ms | 1628 KiB | 13 Q