3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function test(): Foo { return new self; } } $method = new ReflectionMethod("Foo", "test"); $type = $method->getReturnType(); var_dump($type, (string) $type);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6v0WO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $method, !1 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'Foo'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   10     5        INIT_METHOD_CALL                                         !0, 'getReturnType'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   12     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        CAST                                          6  ~7      !1
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.4 ms | 999 KiB | 14 Q