3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace fema\enums; class DocEnum extends Enum { private static $enums = null; private function __construct() { } /** * @inheritDoc */ public static function getAll() : array { if (static::$enums === null) { $last = new \ReflectionClass(static::class); /** @var \ReflectionClass[] $classes */ $classes = [$last]; while ($last->getParentClass()->getName() !== self::class) { //Put on top of array array_unshift($classes, $last = new \ReflectionClass($last->getParentClass()->getName())); } $enums = []; $ordinal = 0; foreach ($classes as $class) { $doc = $class->getDocComment(); $matches = []; if (preg_match_all('/^\\s*\\*\\s*@method\\s+static\\s+([A-Z]+)\\(\\)\\s*$/m', $doc, $matches) > 0) { foreach ($matches[1] as $name) { $enum = new DocEnum(); $enum->name = $name; $enum->ordinal = $ordinal++; $enums[] = $enum; } } } static::$enums = $enums; } return static::$enums; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1QRK
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'fema%5Cenums%5Cdocenum', 'fema%5Cenums%5Cenum'
   46     1      > RETURN                                                   1

Class fema\enums\DocEnum:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1QRK
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   null

End of function __construct

Function getall:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 63
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 11
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 60
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 60
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 59
Branch analysis from position: 44
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 58
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 58
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 58
Branch analysis from position: 59
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 11
Branch analysis from position: 29
Branch analysis from position: 11
Branch analysis from position: 63
filename:       /in/b1QRK
function name:  getAll
number of ops:  68
compiled vars:  !0 = $last, !1 = $classes, !2 = $enums, !3 = $ordinal, !4 = $class, !5 = $doc, !6 = $matches, !7 = $name, !8 = $enum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_STATIC_PROP_R          unknown             ~9      'enums'
          1        TYPE_CHECK                                    2          ~9
          2      > JMPZ                                                     ~10, ->63
   20     3    >   NEW                                              $11     'ReflectionClass'
          4        FETCH_CLASS_NAME                                 ~12     
          5        SEND_VAL_EX                                              ~12
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $11
   22     8        INIT_ARRAY                                       ~15     !0
          9        ASSIGN                                                   !1, ~15
   23    10      > JMP                                                      ->23
   25    11    >   INIT_NS_FCALL_BY_NAME                                    'fema%5Cenums%5Carray_unshift'
         12        SEND_VAR_EX                                              !1
         13        NEW                                              $17     'ReflectionClass'
         14        INIT_METHOD_CALL                                         !0, 'getParentClass'
         15        DO_FCALL                                      0  $18     
         16        INIT_METHOD_CALL                                         $18, 'getName'
         17        DO_FCALL                                      0  $19     
         18        SEND_VAR_NO_REF_EX                                       $19
         19        DO_FCALL                                      0          
         20        ASSIGN                                           ~21     !0, $17
         21        SEND_VAL_EX                                              ~21
         22        DO_FCALL                                      0          
   23    23    >   INIT_METHOD_CALL                                         !0, 'getParentClass'
         24        DO_FCALL                                      0  $23     
         25        INIT_METHOD_CALL                                         $23, 'getName'
         26        DO_FCALL                                      0  $24     
         27        IS_NOT_IDENTICAL                                         $24, 'fema%5Cenums%5CDocEnum'
         28      > JMPNZ                                                    ~25, ->11
   28    29    >   ASSIGN                                                   !2, <array>
   29    30        ASSIGN                                                   !3, 0
   30    31      > FE_RESET_R                                       $28     !1, ->60
         32    > > FE_FETCH_R                                               $28, !4, ->60
   31    33    >   INIT_METHOD_CALL                                         !4, 'getDocComment'
         34        DO_FCALL                                      0  $29     
         35        ASSIGN                                                   !5, $29
   32    36        ASSIGN                                                   !6, <array>
   33    37        INIT_NS_FCALL_BY_NAME                                    'fema%5Cenums%5Cpreg_match_all'
         38        SEND_VAL_EX                                              '%2F%5E%5Cs%2A%5C%2A%5Cs%2A%40method%5Cs%2Bstatic%5Cs%2B%28%5BA-Z%5D%2B%29%5C%28%5C%29%5Cs%2A%24%2Fm'
         39        SEND_VAR_EX                                              !5
         40        SEND_VAR_EX                                              !6
         41        DO_FCALL                                      0  $32     
         42        IS_SMALLER                                               0, $32
         43      > JMPZ                                                     ~33, ->59
   34    44    >   FETCH_DIM_R                                      ~34     !6, 1
         45      > FE_RESET_R                                       $35     ~34, ->58
         46    > > FE_FETCH_R                                               $35, !7, ->58
   35    47    >   NEW                                              $36     'fema%5Cenums%5CDocEnum'
         48        DO_FCALL                                      0          
         49        ASSIGN                                                   !8, $36
   36    50        ASSIGN_OBJ                                               !8, 'name'
         51        OP_DATA                                                  !7
   37    52        POST_INC                                         ~41     !3
         53        ASSIGN_OBJ                                               !8, 'ordinal'
         54        OP_DATA                                                  ~41
   38    55        ASSIGN_DIM                                               !2
         56        OP_DATA                                                  !8
   34    57      > JMP                                                      ->46
         58    >   FE_FREE                                                  $35
   30    59    > > JMP                                                      ->32
         60    >   FE_FREE                                                  $28
   42    61        ASSIGN_STATIC_PROP                                       'enums'
         62        OP_DATA                                                  !2
   44    63    >   FETCH_STATIC_PROP_R          unknown             ~44     'enums'
         64        VERIFY_RETURN_TYPE                                       ~44
         65      > RETURN                                                   ~44
   45    66*       VERIFY_RETURN_TYPE                                       
         67*     > RETURN                                                   null

End of function getall

End of class fema\enums\DocEnum.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.1 ms | 1404 KiB | 17 Q