3v4l.org

run code in 500+ PHP versions simultaneously
<?php // declare(strict_types=1); function typeJuggleToInt(int $value): int { return $value; } function typeJuggleToString(string $value): string { return $value; } function isStrictTypesActive(): bool { $check = function (string $value): void { }; try { // Under strict_types a float will not be type-juggled to a string. $check(123.45); return false; } catch (\Throwable $ex) { return true; } } trait changed_tryFrom { private static function is_backing_type_int(): bool { $backingtype = (new \ReflectionEnum(self::class))->getBackingType()->getName(); return 'int' === $backingtype; } private static function is_backing_type_string(): bool { $backingtype = (new \ReflectionEnum(self::class))->getBackingType()->getName(); return 'string' === $backingtype; } public static function changed_tryFrom(mixed $value): self|null { if ($value instanceof self) { // nothing to do, already a valid "self". return $value; } elseif (is_int($value)) { if (isStrictTypesActive()) { if (!self::is_backing_type_int()) { // prevent Argument #1 ($value) must be of type int return null; } } // take the normal int path return self::tryFrom($value); } elseif (is_string($value)) { if (isStrictTypesActive()) { if (!self::is_backing_type_string()) { // prevent Argument #1 ($value) must be of type string return null; } } // take the normal string path return self::tryFrom($value); } elseif (null === $value) { // A backed enum of type int or type string can never contain the null value. // Prevent warning "Passing null to parameter #1 ($value) of type string|int is deprecated". return null; } else { if (!isStrictTypesActive()) { // no strict_types statement --> type juggling is active. // // BC type-juggling // type juggling: Coercive typing with union types // 1. int, 2. string try { return self::tryFrom(typeJuggleToInt($value)); } catch (\Throwable $ex) { // can't be type juggled to int } try { return self::tryFrom(typeJuggleToString($value)); } catch (\Throwable $ex) { // can't be type juggled to string } } // invalid type return null; } // never reached } } enum SuitAsInt: int { use \changed_tryFrom; case Clubs = 1; case Diamonds = 2; case Hearts = 3; case Spades = 4; } enum SuitAsString: string { use \changed_tryFrom; case Clubs = '1'; case Diamonds = '2'; case Hearts = '3'; case Spades = '4'; } $testcases = [ new \DateTimeImmutable(), null, 4, 4.0, '4', \SuitAsInt::Spades, \SuitAsString::Spades, ]; foreach ($testcases as $testcase) { echo '----------------------------------------'."\n"; echo '--------------[ TESTCASE ]--------------'."\n"; echo '----------------------------------------'."\n"; var_dump($testcase); echo "\n"; echo '------- [ INT backed enum ] -------'."\n"; echo '--- SuitAsInt::tryFrom()'."\n"; try { $value = \SuitAsInt::tryFrom($testcase); if (null !== $value) { echo 'Value is '.$value->name.' with value '.$value->value.'.'."\n"; } else { echo 'Value is NULL.'."\n"; } } catch (\Throwable $exception) { echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo '--- SuitAsInt::changed_tryFrom() [CHANGED]'."\n"; try { $value = \SuitAsInt::changed_tryFrom($testcase); if (null !== $value) { echo 'Value is '.$value->name.' with value '.$value->value.'.'."\n"; } else { echo 'Value is NULL.'."\n"; } } catch (\Throwable $exception) { echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "\n"; echo '------- [ STRING backed enum ] -------'."\n"; echo '--- SuitAsString::tryFrom()'."\n"; try { $value = \SuitAsString::tryFrom($testcase); if (null !== $value) { echo 'Value is '.$value->name.' with value '.$value->value.'.'."\n"; } else { echo 'Value is NULL.'."\n"; } } catch (\Throwable $exception) { echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo '--- SuitAsString::changed_tryFrom() [CHANGED]'."\n"; try { $value = \SuitAsString::changed_tryFrom($testcase); if (null !== $value) { echo 'Value is '.$value->name.' with value '.$value->value.'.'."\n"; } else { echo 'Value is NULL.'."\n"; } } catch (\Throwable $exception) { echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "\n"; echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 133
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 133
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 40
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 66
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 94
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 111, Position 2 = 120
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 121
Branch analysis from position: 121
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 120
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 133
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 133
Found catch point at position: 42
Branch analysis from position: 42
2 jumps found. (Code = 107) Position 1 = 43, Position 2 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 66
Branch analysis from position: 57
Branch analysis from position: 66
Found catch point at position: 68
Branch analysis from position: 68
2 jumps found. (Code = 107) Position 1 = 69, Position 2 = -2
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 94
Branch analysis from position: 85
Branch analysis from position: 94
Found catch point at position: 96
Branch analysis from position: 96
2 jumps found. (Code = 107) Position 1 = 97, Position 2 = -2
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 111, Position 2 = 120
Branch analysis from position: 111
Branch analysis from position: 120
Found catch point at position: 122
Branch analysis from position: 122
2 jumps found. (Code = 107) Position 1 = 123, Position 2 = -2
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
filename:       /in/h9cNW
function name:  (null)
number of ops:  135
compiled vars:  !0 = $testcases, !1 = $testcase, !2 = $value, !3 = $exception
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  104     0  E >   DECLARE_CLASS                                                'suitasint'
  114     1        DECLARE_CLASS                                                'suitasstring'
  125     2        NEW                                                  $4      'DateTimeImmutable'
          3        DO_FCALL                                          0          
          4        INIT_ARRAY                                           ~6      $4
          5        ADD_ARRAY_ELEMENT                                    ~6      null
  127     6        ADD_ARRAY_ELEMENT                                    ~6      4
  128     7        ADD_ARRAY_ELEMENT                                    ~6      4
  129     8        ADD_ARRAY_ELEMENT                                    ~6      '4'
  130     9        FETCH_CLASS_CONSTANT                                 ~7      'SuitAsInt', 'Spades'
         10        ADD_ARRAY_ELEMENT                                    ~6      ~7
  131    11        FETCH_CLASS_CONSTANT                                 ~8      'SuitAsString', 'Spades'
         12        ADD_ARRAY_ELEMENT                                    ~6      ~8
  124    13        ASSIGN                                                       !0, ~6
  134    14      > FE_RESET_R                                           $10     !0, ->133
         15    > > FE_FETCH_R                                                   $10, !1, ->133
  135    16    >   ECHO                                                         '----------------------------------------%0A'
  136    17        ECHO                                                         '--------------%5B+TESTCASE+%5D--------------%0A'
  137    18        ECHO                                                         '----------------------------------------%0A'
  138    19        INIT_FCALL                                                   'var_dump'
         20        SEND_VAR                                                     !1
         21        DO_ICALL                                                     
  140    22        ECHO                                                         '%0A'
  141    23        ECHO                                                         '-------+%5B+INT+backed+enum+%5D+-------%0A'
  143    24        ECHO                                                         '---+SuitAsInt%3A%3AtryFrom%28%29%0A'
  145    25        INIT_STATIC_METHOD_CALL                                      'SuitAsInt', 'tryFrom'
         26        SEND_VAR_EX                                                  !1
         27        DO_FCALL                                          0  $12     
         28        ASSIGN                                                       !2, $12
  146    29        TYPE_CHECK                                      1020          !2
         30      > JMPZ                                                         ~14, ->40
  147    31    >   FETCH_OBJ_R                                          ~15     !2, 'name'
         32        CONCAT                                               ~16     'Value+is+', ~15
         33        CONCAT                                               ~17     ~16, '+with+value+'
         34        FETCH_OBJ_R                                          ~18     !2, 'value'
         35        CONCAT                                               ~19     ~17, ~18
         36        CONCAT                                               ~20     ~19, '.'
         37        CONCAT                                               ~21     ~20, '%0A'
         38        ECHO                                                         ~21
  146    39      > JMP                                                          ->41
  149    40    >   ECHO                                                         'Value+is+NULL.%0A'
         41    > > JMP                                                          ->50
  151    42  E > > CATCH                                           last         'Throwable'
  152    43    >   FETCH_CLASS_NAME                                     ~22     !3
         44        ECHO                                                         ~22
         45        ECHO                                                         '%3A+'
         46        INIT_METHOD_CALL                                             !3, 'getMessage'
         47        DO_FCALL                                          0  $23     
         48        ECHO                                                         $23
         49        ECHO                                                         '%0A'
  155    50    >   ECHO                                                         '---+SuitAsInt%3A%3Achanged_tryFrom%28%29+%5BCHANGED%5D%0A'
  157    51        INIT_STATIC_METHOD_CALL                                      'SuitAsInt', 'changed_tryFrom'
         52        SEND_VAR_EX                                                  !1
         53        DO_FCALL                                          0  $24     
         54        ASSIGN                                                       !2, $24
  158    55        TYPE_CHECK                                      1020          !2
         56      > JMPZ                                                         ~26, ->66
  159    57    >   FETCH_OBJ_R                                          ~27     !2, 'name'
         58        CONCAT                                               ~28     'Value+is+', ~27
         59        CONCAT                                               ~29     ~28, '+with+value+'
         60        FETCH_OBJ_R                                          ~30     !2, 'value'
         61        CONCAT                                               ~31     ~29, ~30
         62        CONCAT                                               ~32     ~31, '.'
         63        CONCAT                                               ~33     ~32, '%0A'
         64        ECHO                                                         ~33
  158    65      > JMP                                                          ->67
  161    66    >   ECHO                                                         'Value+is+NULL.%0A'
         67    > > JMP                                                          ->76
  163    68  E > > CATCH                                           last         'Throwable'
  164    69    >   FETCH_CLASS_NAME                                     ~34     !3
         70        ECHO                                                         ~34
         71        ECHO                                                         '%3A+'
         72        INIT_METHOD_CALL                                             !3, 'getMessage'
         73        DO_FCALL                                          0  $35     
         74        ECHO                                                         $35
         75        ECHO                                                         '%0A'
  167    76    >   ECHO                                                         '%0A'
  168    77        ECHO                                                         '-------+%5B+STRING+backed+enum+%5D+-------%0A'
  170    78        ECHO                                                         '---+SuitAsString%3A%3AtryFrom%28%29%0A'
  172    79        INIT_STATIC_METHOD_CALL                                      'SuitAsString', 'tryFrom'
         80        SEND_VAR_EX                                                  !1
         81        DO_FCALL                                          0  $36     
         82        ASSIGN                                                       !2, $36
  173    83        TYPE_CHECK                                      1020          !2
         84      > JMPZ                                                         ~38, ->94
  174    85    >   FETCH_OBJ_R                                          ~39     !2, 'name'
         86        CONCAT                                               ~40     'Value+is+', ~39
         87        CONCAT                                               ~41     ~40, '+with+value+'
         88        FETCH_OBJ_R                                          ~42     !2, 'value'
         89        CONCAT                                               ~43     ~41, ~42
         90        CONCAT                                               ~44     ~43, '.'
         91        CONCAT                                               ~45     ~44, '%0A'
         92        ECHO                                                         ~45
  173    93      > JMP                                                          ->95
  176    94    >   ECHO                                                         'Value+is+NULL.%0A'
         95    > > JMP                                                          ->104
  178    96  E > > CATCH                                           last         'Throwable'
  179    97    >   FETCH_CLASS_NAME                                     ~46     !3
         98        ECHO                                                         ~46
         99        ECHO                                                         '%3A+'
        100        INIT_METHOD_CALL                                             !3, 'getMessage'
        101        DO_FCALL                                          0  $47     
        102        ECHO                                                         $47
        103        ECHO                                                         '%0A'
  182   104    >   ECHO                                                         '---+SuitAsString%3A%3Achanged_tryFrom%28%29+%5BCHANGED%5D%0A'
  184   105        INIT_STATIC_METHOD_CALL                                      'SuitAsString', 'changed_tryFrom'
        106        SEND_VAR_EX                                                  !1
        107        DO_FCALL                                          0  $48     
        108        ASSIGN                                                       !2, $48
  185   109        TYPE_CHECK                                      1020          !2
        110      > JMPZ                                                         ~50, ->120
  186   111    >   FETCH_OBJ_R                                          ~51     !2, 'name'
        112        CONCAT                                               ~52     'Value+is+', ~51
        113        CONCAT                                               ~53     ~52, '+with+value+'
        114        FETCH_OBJ_R                                          ~54     !2, 'value'
        115        CONCAT                                               ~55     ~53, ~54
        116        CONCAT                                               ~56     ~55, '.'
        117        CONCAT                                               ~57     ~56, '%0A'
        118        ECHO                                                         ~57
  185   119      > JMP                                                          ->121
  188   120    >   ECHO                                                         'Value+is+NULL.%0A'
        121    > > JMP                                                          ->130
  190   122  E > > CATCH                                           last         'Throwable'
  191   123    >   FETCH_CLASS_NAME                                     ~58     !3
        124        ECHO                                                         ~58
        125        ECHO                                                         '%3A+'
        126        INIT_METHOD_CALL                                             !3, 'getMessage'
        127        DO_FCALL                                          0  $59     
        128        ECHO                                                         $59
        129        ECHO                                                         '%0A'
  194   130    >   ECHO                                                         '%0A'
  195   131        ECHO                                                         '%0A'
  134   132      > JMP                                                          ->15
        133    >   FE_FREE                                                      $10
  196   134      > RETURN                                                       1

Function typejuggletoint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  typeJuggleToInt
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    7     1        VERIFY_RETURN_TYPE                                           !0
          2      > RETURN                                                       !0
    8     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function typejuggletoint

Function typejuggletostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  typeJuggleToString
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   12     1        VERIFY_RETURN_TYPE                                           !0
          2      > RETURN                                                       !0
   13     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function typejuggletostring

Function isstricttypesactive:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 7
Branch analysis from position: 7
2 jumps found. (Code = 107) Position 1 = 8, Position 2 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  isStrictTypesActive
number of ops:  11
compiled vars:  !0 = $check, !1 = $ex
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          1        ASSIGN                                                       !0, ~2
   22     2        INIT_DYNAMIC_CALL                                            !0
          3        SEND_VAL_EX                                                  123.45
          4        DO_FCALL                                          0          
   24     5      > RETURN                                                       <false>
          6*       JMP                                                          ->9
   25     7  E > > CATCH                                           last         'Throwable'
   26     8    > > RETURN                                                       <true>
   28     9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  {closure:isStrictTypesActive():17}
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1      > RETURN                                                       null

End of Dynamic Function 0

End of function isstricttypesactive

Class changed_tryFrom:
Function is_backing_type_int:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  is_backing_type_int
number of ops:  14
compiled vars:  !0 = $backingtype
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   NEW                                                  $1      'ReflectionEnum'
          1        FETCH_CLASS_NAME                                     ~2      
          2        SEND_VAL_EX                                                  ~2
          3        DO_FCALL                                          0          
          4        INIT_METHOD_CALL                                             $1, 'getBackingType'
          5        DO_FCALL                                          0  $4      
          6        INIT_METHOD_CALL                                             $4, 'getName'
          7        DO_FCALL                                          0  $5      
          8        ASSIGN                                                       !0, $5
   36     9        IS_IDENTICAL                                         ~7      !0, 'int'
         10        VERIFY_RETURN_TYPE                                           ~7
         11      > RETURN                                                       ~7
   37    12*       VERIFY_RETURN_TYPE                                           
         13*     > RETURN                                                       null

End of function is_backing_type_int

Function is_backing_type_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h9cNW
function name:  is_backing_type_string
number of ops:  14
compiled vars:  !0 = $backingtype
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   41     0  E >   NEW                                                  $1      'ReflectionEnum'
          1        FETCH_CLASS_NAME                                     ~2      
          2        SEND_VAL_EX                                                  ~2
          3        DO_FCALL                                          0          
          4        INIT_METHOD_CALL                                             $1, 'getBackingType'
          5        DO_FCALL                                          0  $4      
          6        INIT_METHOD_CALL                                             $4, 'getName'
          7        DO_FCALL                                          0  $5      
          8        ASSIGN                                                       !0, $5
   43     9        IS_IDENTICAL                                         ~7      !0, 'string'
         10        VERIFY_RETURN_TYPE                                           ~7
         11      > RETURN                                                       ~7
   44    12*       VERIFY_RETURN_TYPE                                           
         13*     > RETURN                                                       null

End of function is_backing_type_string

Function changed_tryfrom:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 38
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 66
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 55
Branch analysis from position: 55
2 jumps found. (Code = 107) Position 1 = 56, Position 2 = -2
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 65
Branch analysis from position: 65
2 jumps found. (Code = 107) Position 1 = 66, Position 2 = -2
Branch analysis from position: 66
filename:       /in/h9cNW
function name:  changed_tryFrom
number of ops:  69
compiled vars:  !0 = $value, !1 = $ex
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   46     0  E >   RECV                                                 !0      
   48     1        INSTANCEOF                                                   !0
          2      > JMPZ                                                         ~2, ->6
   50     3    >   VERIFY_RETURN_TYPE                                           !0
          4      > RETURN                                                       !0
   48     5*       JMP                                                          ->67
   51     6    >   TYPE_CHECK                                       16          !0
          7      > JMPZ                                                         ~3, ->22
   52     8    >   INIT_FCALL                                                   'isstricttypesactive'
          9        DO_FCALL                                          0  $4      
         10      > JMPZ                                                         $4, ->16
   53    11    >   INIT_STATIC_METHOD_CALL                                      'is_backing_type_int'
         12        DO_FCALL                                          0  $5      
         13        BOOL_NOT                                             ~6      $5
         14      > JMPZ                                                         ~6, ->16
   55    15    > > RETURN                                                       null
   60    16    >   INIT_STATIC_METHOD_CALL                                      'tryFrom'
         17        SEND_VAR_EX                                                  !0
         18        DO_FCALL                                          0  $7      
         19        VERIFY_RETURN_TYPE                                           $7
         20      > RETURN                                                       $7
   51    21*       JMP                                                          ->67
   61    22    >   TYPE_CHECK                                       64          !0
         23      > JMPZ                                                         ~8, ->38
   62    24    >   INIT_FCALL                                                   'isstricttypesactive'
         25        DO_FCALL                                          0  $9      
         26      > JMPZ                                                         $9, ->32
   63    27    >   INIT_STATIC_METHOD_CALL                                      'is_backing_type_string'
         28        DO_FCALL                                          0  $10     
         29        BOOL_NOT                                             ~11     $10
         30      > JMPZ                                                         ~11, ->32
   65    31    > > RETURN                                                       null
   70    32    >   INIT_STATIC_METHOD_CALL                                      'tryFrom'
         33        SEND_VAR_EX                                                  !0
         34        DO_FCALL                                          0  $12     
         35        VERIFY_RETURN_TYPE                                           $12
         36      > RETURN                                                       $12
   61    37*       JMP                                                          ->67
   71    38    >   TYPE_CHECK                                        2          !0
         39      > JMPZ                                                         ~13, ->42
   74    40    > > RETURN                                                       null
   71    41*       JMP                                                          ->67
   76    42    >   INIT_FCALL                                                   'isstricttypesactive'
         43        DO_FCALL                                          0  $14     
         44        BOOL_NOT                                             ~15     $14
         45      > JMPZ                                                         ~15, ->66
   84    46    >   INIT_STATIC_METHOD_CALL                                      'tryFrom'
         47        INIT_FCALL                                                   'typejuggletoint'
         48        SEND_VAR                                                     !0
         49        DO_FCALL                                          0  $16     
         50        SEND_VAR_NO_REF_EX                                           $16
         51        DO_FCALL                                          0  $17     
         52        VERIFY_RETURN_TYPE                                           $17
         53      > RETURN                                                       $17
         54*       JMP                                                          ->56
   85    55  E > > CATCH                                           last         'Throwable'
   90    56    >   INIT_STATIC_METHOD_CALL                                      'tryFrom'
         57        INIT_FCALL                                                   'typejuggletostring'
         58        SEND_VAR                                                     !0
         59        DO_FCALL                                          0  $18     
         60        SEND_VAR_NO_REF_EX                                           $18
         61        DO_FCALL                                          0  $19     
         62        VERIFY_RETURN_TYPE                                           $19
         63      > RETURN                                                       $19
         64*       JMP                                                          ->66
   91    65  E > > CATCH                                           last         'Throwable'
   97    66    > > RETURN                                                       null
  101    67*       VERIFY_RETURN_TYPE                                           
         68*     > RETURN                                                       null

End of function changed_tryfrom

End of class changed_tryFrom.

Class SuitAsInt: [no user functions]
Class SuitAsString: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
124.18 ms | 509 KiB | 13 Q