3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public function test(): B { } } function getB(): B { } $rc = new ReflectionMethod('B', 'test'); var_dump((string)$rc->getReturnType(), $rc->getReturnType()); $rc = new ReflectionFunction('getB'); var_dump((string)$rc->getReturnType(), $rc->getReturnType());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pmu6c
function name:  (null)
number of ops:  28
compiled vars:  !0 = $rc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'ReflectionMethod'
          1        SEND_VAL_EX                                              'B'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   17     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getReturnType'
          7        DO_FCALL                                      0  $4      
          8        CAST                                          6  ~5      $4
          9        SEND_VAL                                                 ~5
         10        INIT_METHOD_CALL                                         !0, 'getReturnType'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
   19    14        NEW                                              $8      'ReflectionFunction'
         15        SEND_VAL_EX                                              'getB'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !0, $8
   20    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'getReturnType'
         20        DO_FCALL                                      0  $11     
         21        CAST                                          6  ~12     $11
         22        SEND_VAL                                                 ~12
         23        INIT_METHOD_CALL                                         !0, 'getReturnType'
         24        DO_FCALL                                      0  $13     
         25        SEND_VAR                                                 $13
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pmu6c
function name:  getB
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function getb

Class B:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pmu6c
function name:  test
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 test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.95 ms | 1396 KiB | 15 Q