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] ?? []; 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/UqjhF
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     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/UqjhF
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 = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/UqjhF
function name:  getListOfFieldErrors
number of ops:  20
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      > FE_RESET_R                                       $8      !1, ->15
          7    > > FE_FETCH_R                                       ~9      $8, !2, ->15
          8    >   ASSIGN                                                   !3, ~9
   17     9        INIT_METHOD_CALL                                         !2, 'get'
         10        SEND_VAL_EX                                              'text'
         11        DO_FCALL                                      0  $12     
         12        ASSIGN_DIM                                               !1, !3
         13        OP_DATA                                                  $12
   16    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $8
   20    16        VERIFY_RETURN_TYPE                                       !1
         17      > RETURN                                                   !1
   21    18*       VERIFY_RETURN_TYPE                                       
         19*     > 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/UqjhF
function name:  isEmpty
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'errors'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   26     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:
136.03 ms | 1000 KiB | 13 Q