3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { } class Foo extends Bar { function getSelf (self $a): self { } function getStatic (): static { } } $refMethodSelf = new ReflectionMethod('Foo', 'getSelf'); $refMethodStatic = new ReflectionMethod('Foo', 'getStatic'); $refParam = $refMethodSelf->getParameters()[0]; print_r(array( 'paramType' => $refParam->getType()->getName(), 'returnTypeSelf' => $refMethodSelf->getReturnType()->getName(), 'returnTypeStatic' => $refMethodStatic->getReturnType()->getName(), ));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ACeW
function name:  (null)
number of ops:  33
compiled vars:  !0 = $refMethodSelf, !1 = $refMethodStatic, !2 = $refParam
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $3      'ReflectionMethod'
          1        SEND_VAL_EX                                              'Foo'
          2        SEND_VAL_EX                                              'getSelf'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   23     5        NEW                                              $6      'ReflectionMethod'
          6        SEND_VAL_EX                                              'Foo'
          7        SEND_VAL_EX                                              'getStatic'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   24    10        INIT_METHOD_CALL                                         !0, 'getParameters'
         11        DO_FCALL                                      0  $9      
         12        FETCH_DIM_R                                      ~10     $9, 0
         13        ASSIGN                                                   !2, ~10
   26    14        INIT_FCALL                                               'print_r'
   27    15        INIT_METHOD_CALL                                         !2, 'getType'
         16        DO_FCALL                                      0  $12     
         17        INIT_METHOD_CALL                                         $12, 'getName'
         18        DO_FCALL                                      0  $13     
         19        INIT_ARRAY                                       ~14     $13, 'paramType'
   28    20        INIT_METHOD_CALL                                         !0, 'getReturnType'
         21        DO_FCALL                                      0  $15     
         22        INIT_METHOD_CALL                                         $15, 'getName'
         23        DO_FCALL                                      0  $16     
         24        ADD_ARRAY_ELEMENT                                ~14     $16, 'returnTypeSelf'
   29    25        INIT_METHOD_CALL                                         !1, 'getReturnType'
         26        DO_FCALL                                      0  $17     
         27        INIT_METHOD_CALL                                         $17, 'getName'
         28        DO_FCALL                                      0  $18     
         29        ADD_ARRAY_ELEMENT                                ~14     $18, 'returnTypeStatic'
         30        SEND_VAL                                                 ~14
   26    31        DO_ICALL                                                 
   30    32      > RETURN                                                   1

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

End of function getself

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

End of function getstatic

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.74 ms | 1091 KiB | 14 Q