3v4l.org

run code in 300+ PHP versions simultaneously
<?php class YearIsValid implements ValidatorRuleInterface { private string $errorText; private int $minYear; private int $maxYear; public function __construct(int $minYear, int $maxYear) { $this->minYear = $minYear; $this->maxYear = $maxYear; $this->errorText = "Год рождения не может быть меньше $this->minYear и не может быть больше $this->maxYear."; } public function __invoke(mixed $value): ?ValidationError { if (!is_int($value)) { throw new TypeException("Неправильный тип данных в аргументе функции."); } $resultMin = $value < $minYear; $resultMax = $value > $maxYear; if ($resultMin || $resultMax) { return new ValidationError($this->errorText); } else { return null; } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3meF5
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'yearisvalid'
   35     1      > RETURN                                                   1

Class YearIsValid:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3meF5
function name:  __construct
number of ops:  16
compiled vars:  !0 = $minYear, !1 = $maxYear
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ASSIGN_OBJ                                               'minYear'
          3        OP_DATA                                                  !0
   14     4        ASSIGN_OBJ                                               'maxYear'
          5        OP_DATA                                                  !1
   15     6        ROPE_INIT                                     5  ~8      '%D0%93%D0%BE%D0%B4+%D1%80%D0%BE%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D1%8F+%D0%BD%D0%B5+%D0%BC%D0%BE%D0%B6%D0%B5%D1%82+%D0%B1%D1%8B%D1%82%D1%8C+%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5+'
          7        FETCH_OBJ_R                                      ~5      'minYear'
          8        ROPE_ADD                                      1  ~8      ~8, ~5
          9        ROPE_ADD                                      2  ~8      ~8, '+%D0%B8+%D0%BD%D0%B5+%D0%BC%D0%BE%D0%B6%D0%B5%D1%82+%D0%B1%D1%8B%D1%82%D1%8C+%D0%B1%D0%BE%D0%BB%D1%8C%D1%88%D0%B5+'
         10        FETCH_OBJ_R                                      ~6      'maxYear'
         11        ROPE_ADD                                      3  ~8      ~8, ~6
         12        ROPE_END                                      4  ~7      ~8, '.'
         13        ASSIGN_OBJ                                               'errorText'
         14        OP_DATA                                                  ~7
   16    15      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/3meF5
function name:  __invoke
number of ops:  26
compiled vars:  !0 = $value, !1 = $resultMin, !2 = $minYear, !3 = $resultMax, !4 = $maxYear
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        TYPE_CHECK                                   16  ~5      !0
          2        BOOL_NOT                                         ~6      ~5
          3      > JMPZ                                                     ~6, ->8
   22     4    >   NEW                                              $7      'TypeException'
          5        SEND_VAL_EX                                              '%D0%9D%D0%B5%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9+%D1%82%D0%B8%D0%BF+%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85+%D0%B2+%D0%B0%D1%80%D0%B3%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B5+%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B8.'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $7
   25     8    >   IS_SMALLER                                       ~9      !0, !2
          9        ASSIGN                                                   !1, ~9
   26    10        IS_SMALLER                                       ~11     !4, !0
         11        ASSIGN                                                   !3, ~11
   28    12      > JMPNZ_EX                                         ~13     !1, ->14
         13    >   BOOL                                             ~13     !3
         14    > > JMPZ                                                     ~13, ->23
   30    15    >   NEW                                              $14     'ValidationError'
         16        CHECK_FUNC_ARG                                           
         17        FETCH_OBJ_FUNC_ARG                               $15     'errorText'
         18        SEND_FUNC_ARG                                            $15
         19        DO_FCALL                                      0          
         20        VERIFY_RETURN_TYPE                                       $14
         21      > RETURN                                                   $14
   28    22*       JMP                                                      ->24
   32    23    > > RETURN                                                   null
   34    24*       VERIFY_RETURN_TYPE                                       
         25*     > RETURN                                                   null

End of function __invoke

End of class YearIsValid.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.28 ms | 1000 KiB | 13 Q