3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ErrorList { private array $errors; public function add(string $fieldName, ValidationError $validationError): void { $this->errors[$fieldName][] = $validationError; } public function getListOfFieldErrors(string $fieldName): array { $result = $this->errors[$fieldName] ?? []; if (!$result) { return $result; } foreach ($result as $key => $error) { $result [$key] = $error->get("text"); } return $result; } public function isEmpty(): bool { return empty($this->errors); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uhu5V
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E > > RETURN                                                   1

Class ErrorList:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uhu5V
function name:  add
number of ops:  7
compiled vars:  !0 = $fieldName, !1 = $validationError
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_OBJ_W                                      $2      'errors'
          3        FETCH_DIM_W                                      $3      $2, !0
          4        ASSIGN_DIM                                               $3
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function add

Function getlistoffielderrors:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/Uhu5V
function name:  getListOfFieldErrors
number of ops:  24
compiled vars:  !0 = $fieldName, !1 = $result, !2 = $error, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_IS                                     ~4      'errors'
          2        FETCH_DIM_IS                                     ~5      ~4, !0
          3        COALESCE                                         ~6      ~5
          4        QM_ASSIGN                                        ~6      <array>
          5        ASSIGN                                                   !1, ~6
   16     6        BOOL_NOT                                         ~8      !1
          7      > JMPZ                                                     ~8, ->10
   17     8    >   VERIFY_RETURN_TYPE                                       !1
          9      > RETURN                                                   !1
   20    10    > > FE_RESET_R                                       $9      !1, ->19
         11    > > FE_FETCH_R                                       ~10     $9, !2, ->19
         12    >   ASSIGN                                                   !3, ~10
   21    13        INIT_METHOD_CALL                                         !2, 'get'
         14        SEND_VAL_EX                                              'text'
         15        DO_FCALL                                      0  $13     
         16        ASSIGN_DIM                                               !1, !3
         17        OP_DATA                                                  $13
   20    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $9
   23    20        VERIFY_RETURN_TYPE                                       !1
         21      > RETURN                                                   !1
   24    22*       VERIFY_RETURN_TYPE                                       
         23*     > RETURN                                                   null

End of function getlistoffielderrors

Function isempty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uhu5V
function name:  isEmpty
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'errors'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   29     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function isempty

End of class ErrorList.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.88 ms | 1000 KiB | 13 Q