3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Mocking WordPress function add_filter(string $tag, callable $value) { $GLOBALS[$tag][] = $value; } function _doing_it_wrong($fn, string $message) { echo "\n--------------\nDOING IT WRONG: $message\n--------------\n"; } // ------------------------------------------------------------------ function apply_filters_typesafe( $tag, $arguments = array(), $value = null, ...$values ) { if ( null === $value || empty( $GLOBALS[$tag] ) ) { return apply_filters( $tag, $value, ...$values ); } $type = gettype( $value ); $is_object = false; switch ( $type ) { case 'boolean': $accepted_types = array( 'boolean' ); break; case 'integer': case 'double': $accepted_types = array( 'numeric' ); break; case 'string': $accepted_types = array( 'string' ); break; case 'array': $accepted_types = array( 'array' ); break; case 'resource': case 'resource (closed)': $accepted_types = array( 'resource' ); break; case 'object': $is_object = true; default: $accepted_types = array(); } // Skip calculation of accepted types if they are are explicitly passed. if ( $is_object && empty ( $arguments['accepted_types'] ) ) { $class = get_class( $value ); $accepted_types = array( $class ); $parent = get_parent_class( $class ); while ( $parent ) { $accepted_types[] = $parent; $parent = get_parent_class( $parent ); } $accepted_types = array_merge( $accepted_types, class_implements( $class ) ); } $arguments = array_replace( array( 'nullable' => false, 'accepted_types' => $accepted_types ), $arguments ); $original = $value; // Objects are passed by ref, clone to return original unchanged in case of errors. $to_filter = $is_object ? clone $value : $value; $filter = array_shift($GLOBALS[$tag]); $filtered = $filter( $tag, $to_filter, ...$values ); // 'mixed' is a valid PHP 8 pseudo-type so we support for consistency. // That said, if mixed is fine then just use apply_filters. if ( in_array( 'mixed', (array)$arguments['accepted_types'] ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } static $can_do_it_wrong = false; if ( ! $can_do_it_wrong && function_exists( '_doing_it_wrong' ) ) { $can_do_it_wrong = true; } if ( ( null === $filtered && !$arguments['nullable'] ) ) { if ( $can_do_it_wrong ) { _doing_it_wrong( __FUNCTION__, "Filters for $tag where not expected to return null.", '5.6' ); } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $original, ...$values ) : $filtered; } static $functions; if ( ! $functions ) { $functions = array( 'integer' => 'is_int', 'double' => 'is_float', 'float' => 'is_float', 'numeric' => 'is_numeric', 'number' => 'is_numeric', 'bool' => 'is_bool', 'boolean' => 'is_boolean', 'string' => 'is_string', 'array' => 'is_array', 'callable' => 'is_callable', 'function' => 'is_callable', 'resource' => 'is_resource', 'iterable' => 'is_iterable', 'countable' => 'is_countable', ); } foreach ( $arguments['accepted_types'] as $type ) { if ( isset( $functions[ $type ] ) && call_user_func( $functions[ $type ], $filtered ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } if ( $is_object && is_string ( $type ) && is_a( $filtered, $type ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } } if ( $can_do_it_wrong ) { $expected = implode( ', ', $arguments['accepted_types'] ); $actual = is_object( $filtered ) ? 'instance of ' . get_class($filtered) : gettype( $filtered ); _doing_it_wrong( __FUNCTION__, "Filters for $tag where expected to return a value of one of types $expected. Got $actual instead.", '5.6' ); } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $original, ...$values ) : $filtered; } // Let's try now to add some hooks, the first is bad, the second is good. add_filter('hello', function () { return 'This is not a callable' ; }); add_filter('hello', function () { return function () { return 'It works!'; }; }); // And lets' see if it works: $callable = apply_filters_typesafe('hello', ['accepted_types' => ['callable']], '__return_empty_string'); echo $callable();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3oBi
function name:  (null)
number of ops:  20
compiled vars:  !0 = $callable
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  153     0  E >   INIT_FCALL                                                   'add_filter'
          1        SEND_VAL                                                     'hello'
          2        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
  155     3        SEND_VAL                                                     ~1
  153     4        DO_FCALL                                          0          
  157     5        INIT_FCALL                                                   'add_filter'
          6        SEND_VAL                                                     'hello'
          7        DECLARE_LAMBDA_FUNCTION                              ~3      [1]
  161     8        SEND_VAL                                                     ~3
  157     9        DO_FCALL                                          0          
  166    10        INIT_FCALL                                                   'apply_filters_typesafe'
         11        SEND_VAL                                                     'hello'
         12        SEND_VAL                                                     <array>
         13        SEND_VAL                                                     '__return_empty_string'
         14        DO_FCALL                                          0  $5      
         15        ASSIGN                                                       !0, $5
  167    16        INIT_DYNAMIC_CALL                                            !0
         17        DO_FCALL                                          0  $7      
         18        ECHO                                                         $7
         19      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3oBi
function name:  {closure:/in/d3oBi:153}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  154     0  E > > RETURN                                                       'This+is+not+a+callable'
  155     1*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3oBi
function name:  {closure:/in/d3oBi:157}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  158     0  E >   DECLARE_LAMBDA_FUNCTION                              ~0      [0]
  160     1      > RETURN                                                       ~0
  161     2*     > 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/d3oBi
function name:  {closure:{closure:/in/d3oBi:157}:158}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  159     0  E > > RETURN                                                       'It+works%21'
  160     1*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 1

Function add_filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3oBi
function name:  add_filter
number of ops:  6
compiled vars:  !0 = $tag, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        FETCH_W                          global              $2      !0
          3        ASSIGN_DIM                                                   $2
          4        OP_DATA                                                      !1
    5     5      > RETURN                                                       null

End of function add_filter

Function _doing_it_wrong:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3oBi
function name:  _doing_it_wrong
number of ops:  7
compiled vars:  !0 = $fn, !1 = $message
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    8     2        ROPE_INIT                                         3  ~3      '%0A--------------%0ADOING+IT+WRONG%3A+'
          3        ROPE_ADD                                          1  ~3      ~3, !1
          4        ROPE_END                                          2  ~2      ~3, '%0A--------------%0A'
          5        ECHO                                                         ~2
    9     6      > RETURN                                                       null

End of function _doing_it_wrong

Function apply_filters_typesafe:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
10 jumps found. (Code = 188) Position 1 = 37, Position 2 = 39, Position 3 = 39, Position 4 = 41, Position 5 = 43, Position 6 = 45, Position 7 = 45, Position 8 = 47, Position 9 = 48, Position 10 = 20
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 46) Position 1 = 50, Position 2 = 52
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 77
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 62
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 89
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 90
Branch analysis from position: 90
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 120
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 109, Position 2 = 118
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 119
Branch analysis from position: 119
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 118
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 120
2 jumps found. (Code = 46) Position 1 = 123, Position 2 = 127
Branch analysis from position: 123
2 jumps found. (Code = 43) Position 1 = 128, Position 2 = 129
Branch analysis from position: 128
2 jumps found. (Code = 46) Position 1 = 131, Position 2 = 134
Branch analysis from position: 131
2 jumps found. (Code = 43) Position 1 = 135, Position 2 = 157
Branch analysis from position: 135
2 jumps found. (Code = 43) Position 1 = 136, Position 2 = 144
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 146, Position 2 = 155
Branch analysis from position: 146
1 jumps found. (Code = 42) Position 1 = 156
Branch analysis from position: 156
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 155
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 144
Branch analysis from position: 157
2 jumps found. (Code = 43) Position 1 = 160, Position 2 = 161
Branch analysis from position: 160
2 jumps found. (Code = 77) Position 1 = 163, Position 2 = 211
Branch analysis from position: 163
2 jumps found. (Code = 78) Position 1 = 164, Position 2 = 211
Branch analysis from position: 164
2 jumps found. (Code = 46) Position 1 = 166, Position 2 = 171
Branch analysis from position: 166
2 jumps found. (Code = 43) Position 1 = 172, Position 2 = 186
Branch analysis from position: 172
2 jumps found. (Code = 43) Position 1 = 174, Position 2 = 183
Branch analysis from position: 174
1 jumps found. (Code = 42) Position 1 = 184
Branch analysis from position: 184
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 183
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 186
2 jumps found. (Code = 46) Position 1 = 187, Position 2 = 189
Branch analysis from position: 187
2 jumps found. (Code = 46) Position 1 = 190, Position 2 = 195
Branch analysis from position: 190
2 jumps found. (Code = 43) Position 1 = 196, Position 2 = 210
Branch analysis from position: 196
2 jumps found. (Code = 43) Position 1 = 198, Position 2 = 207
Branch analysis from position: 198
1 jumps found. (Code = 42) Position 1 = 208
Branch analysis from position: 208
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 207
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 210
1 jumps found. (Code = 42) Position 1 = 163
Branch analysis from position: 163
Branch analysis from position: 195
Branch analysis from position: 189
Branch analysis from position: 171
Branch analysis from position: 211
2 jumps found. (Code = 43) Position 1 = 213, Position 2 = 237
Branch analysis from position: 213
2 jumps found. (Code = 43) Position 1 = 218, Position 2 = 222
Branch analysis from position: 218
1 jumps found. (Code = 42) Position 1 = 224
Branch analysis from position: 224
2 jumps found. (Code = 43) Position 1 = 239, Position 2 = 248
Branch analysis from position: 239
1 jumps found. (Code = 42) Position 1 = 249
Branch analysis from position: 249
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 248
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 222
2 jumps found. (Code = 43) Position 1 = 239, Position 2 = 248
Branch analysis from position: 239
Branch analysis from position: 248
Branch analysis from position: 237
Branch analysis from position: 211
Branch analysis from position: 161
Branch analysis from position: 134
Branch analysis from position: 129
Branch analysis from position: 127
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 120
Branch analysis from position: 107
Branch analysis from position: 120
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 62
Branch analysis from position: 69
Branch analysis from position: 62
Branch analysis from position: 77
Branch analysis from position: 52
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 39
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 45
Branch analysis from position: 47
2 jumps found. (Code = 46) Position 1 = 50, Position 2 = 52
Branch analysis from position: 50
Branch analysis from position: 52
Branch analysis from position: 48
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 37
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 39
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 41
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 43
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 45
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 45
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 47
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 47
Branch analysis from position: 45
Branch analysis from position: 45
Branch analysis from position: 43
Branch analysis from position: 41
Branch analysis from position: 39
Branch analysis from position: 39
Branch analysis from position: 37
Branch analysis from position: 8
filename:       /in/d3oBi
function name:  apply_filters_typesafe
number of ops:  251
compiled vars:  !0 = $tag, !1 = $arguments, !2 = $value, !3 = $values, !4 = $type, !5 = $is_object, !6 = $accepted_types, !7 = $class, !8 = $parent, !9 = $original, !10 = $to_filter, !11 = $filter, !12 = $filtered, !13 = $can_do_it_wrong, !14 = $functions, !15 = $expected, !16 = $actual
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
          2        RECV_INIT                                            !2      null
          3        RECV_VARIADIC                                        !3      
   15     4        TYPE_CHECK                                        2  ~17     !2
          5      > JMPNZ_EX                                             ~17     ~17, ->8
          6    >   ISSET_ISEMPTY_VAR                                 3  ~18     !0
          7        BOOL                                                 ~17     ~18
          8    > > JMPZ                                                         ~17, ->16
   16     9    >   INIT_FCALL_BY_NAME                                           'apply_filters'
         10        SEND_VAR_EX                                                  !0
         11        SEND_VAR_EX                                                  !2
         12        SEND_UNPACK                                                  !3
         13        CHECK_UNDEF_ARGS                                             
         14        DO_FCALL                                          1  $19     
         15      > RETURN                                                       $19
   19    16    >   GET_TYPE                                             ~20     !2
         17        ASSIGN                                                       !4, ~20
   20    18        ASSIGN                                                       !5, <false>
   21    19      > SWITCH_STRING                                                !4, [ 'boolean':->37, 'integer':->39, 'double':->39, 'string':->41, 'array':->43, 'resource':->45, 'resource+%28closed%29':->45, 'object':->47, ], ->48
   22    20    >   IS_EQUAL                                                     !4, 'boolean'
         21      > JMPNZ                                                        ~23, ->37
   25    22    >   IS_EQUAL                                                     !4, 'integer'
         23      > JMPNZ                                                        ~23, ->39
   26    24    >   IS_EQUAL                                                     !4, 'double'
         25      > JMPNZ                                                        ~23, ->39
   29    26    >   IS_EQUAL                                                     !4, 'string'
         27      > JMPNZ                                                        ~23, ->41
   32    28    >   IS_EQUAL                                                     !4, 'array'
         29      > JMPNZ                                                        ~23, ->43
   35    30    >   IS_EQUAL                                                     !4, 'resource'
         31      > JMPNZ                                                        ~23, ->45
   36    32    >   IS_EQUAL                                                     !4, 'resource+%28closed%29'
         33      > JMPNZ                                                        ~23, ->45
   39    34    >   IS_EQUAL                                                     !4, 'object'
         35      > JMPNZ                                                        ~23, ->47
         36    > > JMP                                                          ->48
   23    37    >   ASSIGN                                                       !6, <array>
   24    38      > JMP                                                          ->49
   27    39    >   ASSIGN                                                       !6, <array>
   28    40      > JMP                                                          ->49
   30    41    >   ASSIGN                                                       !6, <array>
   31    42      > JMP                                                          ->49
   33    43    >   ASSIGN                                                       !6, <array>
   34    44      > JMP                                                          ->49
   37    45    >   ASSIGN                                                       !6, <array>
   38    46      > JMP                                                          ->49
   40    47    >   ASSIGN                                                       !5, <true>
   42    48    >   ASSIGN                                                       !6, <array>
   46    49    > > JMPZ_EX                                              ~31     !5, ->52
         50    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~32     !1, 'accepted_types'
         51        BOOL                                                 ~31     ~32
         52    > > JMPZ                                                         ~31, ->77
   47    53    >   GET_CLASS                                            ~33     !2
         54        ASSIGN                                                       !7, ~33
   48    55        INIT_ARRAY                                           ~35     !7
         56        ASSIGN                                                       !6, ~35
   49    57        INIT_FCALL                                                   'get_parent_class'
         58        SEND_VAR                                                     !7
         59        DO_ICALL                                             $37     
         60        ASSIGN                                                       !8, $37
   50    61      > JMP                                                          ->68
   51    62    >   ASSIGN_DIM                                                   !6
         63        OP_DATA                                                      !8
   52    64        INIT_FCALL                                                   'get_parent_class'
         65        SEND_VAR                                                     !8
         66        DO_ICALL                                             $40     
         67        ASSIGN                                                       !8, $40
   50    68    > > JMPNZ                                                        !8, ->62
   55    69    >   INIT_FCALL                                                   'array_merge'
         70        SEND_VAR                                                     !6
         71        INIT_FCALL                                                   'class_implements'
         72        SEND_VAR                                                     !7
         73        DO_ICALL                                             $42     
         74        SEND_VAR                                                     $42
         75        DO_ICALL                                             $43     
         76        ASSIGN                                                       !6, $43
   58    77    >   INIT_FCALL                                                   'array_replace'
   60    78        INIT_ARRAY                                           ~45     <false>, 'nullable'
   61    79        ADD_ARRAY_ELEMENT                                    ~45     !6, 'accepted_types'
         80        SEND_VAL                                                     ~45
   63    81        SEND_VAR                                                     !1
   58    82        DO_ICALL                                             $46     
         83        ASSIGN                                                       !1, $46
   66    84        ASSIGN                                                       !9, !2
   68    85      > JMPZ                                                         !5, ->89
         86    >   CLONE                                                ~49     !2
         87        QM_ASSIGN                                            ~50     ~49
         88      > JMP                                                          ->90
         89    >   QM_ASSIGN                                            ~50     !2
         90    >   ASSIGN                                                       !10, ~50
   70    91        INIT_FCALL                                                   'array_shift'
         92        FETCH_W                          global              $52     !0
         93        SEND_REF                                                     $52
         94        DO_ICALL                                             $53     
         95        ASSIGN                                                       !11, $53
   72    96        INIT_DYNAMIC_CALL                                            !11
         97        SEND_VAR_EX                                                  !0
         98        SEND_VAR_EX                                                  !10
         99        SEND_UNPACK                                                  !3
        100        CHECK_UNDEF_ARGS                                             
        101        DO_FCALL                                          1  $55     
        102        ASSIGN                                                       !12, $55
   76   103        FETCH_DIM_R                                          ~57     !1, 'accepted_types'
        104        CAST                                              7  ~58     ~57
        105        FRAMELESS_ICALL_2                in_array            ~59     'mixed', ~58
        106      > JMPZ                                                         ~59, ->120
   77   107    >   FETCH_R                          global              ~60     !0
        108      > JMPZ                                                         ~60, ->118
   78   109    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        110        SEND_VAR_EX                                                  !0
        111        SEND_VAR_EX                                                  !1
        112        SEND_VAR_EX                                                  !12
        113        SEND_UNPACK                                                  !3
        114        CHECK_UNDEF_ARGS                                             
        115        DO_FCALL                                          1  $61     
        116        QM_ASSIGN                                            ~62     $61
        117      > JMP                                                          ->119
   79   118    >   QM_ASSIGN                                            ~62     !12
        119    > > RETURN                                                       ~62
   82   120    >   BIND_STATIC                                                  !13
   83   121        BOOL_NOT                                             ~63     !13
        122      > JMPZ_EX                                              ~63     ~63, ->127
        123    >   INIT_FCALL                                                   'function_exists'
        124        SEND_VAL                                                     '_doing_it_wrong'
        125        DO_ICALL                                             $64     
        126        BOOL                                                 ~63     $64
        127    > > JMPZ                                                         ~63, ->129
   84   128    >   ASSIGN                                                       !13, <true>
   87   129    >   TYPE_CHECK                                        2  ~66     !12
        130      > JMPZ_EX                                              ~66     ~66, ->134
        131    >   FETCH_DIM_R                                          ~67     !1, 'nullable'
        132        BOOL_NOT                                             ~68     ~67
        133        BOOL                                                 ~66     ~68
        134    > > JMPZ                                                         ~66, ->157
   88   135    > > JMPZ                                                         !13, ->144
   89   136    >   INIT_FCALL                                                   '_doing_it_wrong'
   90   137        SEND_VAL                                                     'apply_filters_typesafe'
   91   138        ROPE_INIT                                         3  ~70     'Filters+for+'
        139        ROPE_ADD                                          1  ~70     ~70, !0
        140        ROPE_END                                          2  ~69     ~70, '+where+not+expected+to+return+null.'
        141        SEND_VAL                                                     ~69
   92   142        SEND_VAL                                                     '5.6'
   89   143        DO_FCALL                                          0          
   96   144    >   FETCH_R                          global              ~73     !0
        145      > JMPZ                                                         ~73, ->155
   97   146    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        147        SEND_VAR_EX                                                  !0
        148        SEND_VAR_EX                                                  !1
        149        SEND_VAR_EX                                                  !9
        150        SEND_UNPACK                                                  !3
        151        CHECK_UNDEF_ARGS                                             
        152        DO_FCALL                                          1  $74     
        153        QM_ASSIGN                                            ~75     $74
        154      > JMP                                                          ->156
   98   155    >   QM_ASSIGN                                            ~75     !12
        156    > > RETURN                                                       ~75
  101   157    >   BIND_STATIC                                                  !14
  102   158        BOOL_NOT                                             ~76     !14
        159      > JMPZ                                                         ~76, ->161
  103   160    >   ASSIGN                                                       !14, <array>
  121   161    >   FETCH_DIM_R                                          ~78     !1, 'accepted_types'
        162      > FE_RESET_R                                           $79     ~78, ->211
        163    > > FE_FETCH_R                                                   $79, !4, ->211
  122   164    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~80     !14, !4
        165      > JMPZ_EX                                              ~80     ~80, ->171
        166    >   FETCH_DIM_R                                          ~81     !14, !4
        167        INIT_USER_CALL                                    1          'call_user_func', ~81
        168        SEND_USER                                                    !12
        169        DO_FCALL                                          0  $82     
        170        BOOL                                                 ~80     $82
        171    > > JMPZ                                                         ~80, ->186
  123   172    >   FETCH_R                          global              ~83     !0
        173      > JMPZ                                                         ~83, ->183
  124   174    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        175        SEND_VAR_EX                                                  !0
        176        SEND_VAR_EX                                                  !1
        177        SEND_VAR_EX                                                  !12
        178        SEND_UNPACK                                                  !3
        179        CHECK_UNDEF_ARGS                                             
        180        DO_FCALL                                          1  $84     
        181        QM_ASSIGN                                            ~85     $84
        182      > JMP                                                          ->184
  125   183    >   QM_ASSIGN                                            ~85     !12
        184    >   FE_FREE                                                      $79
        185      > RETURN                                                       ~85
  128   186    > > JMPZ_EX                                              ~86     !5, ->189
        187    >   TYPE_CHECK                                       64  ~87     !4
        188        BOOL                                                 ~86     ~87
        189    > > JMPZ_EX                                              ~86     ~86, ->195
        190    >   INIT_FCALL                                                   'is_a'
        191        SEND_VAR                                                     !12
        192        SEND_VAR                                                     !4
        193        DO_ICALL                                             $88     
        194        BOOL                                                 ~86     $88
        195    > > JMPZ                                                         ~86, ->210
  129   196    >   FETCH_R                          global              ~89     !0
        197      > JMPZ                                                         ~89, ->207
  130   198    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        199        SEND_VAR_EX                                                  !0
        200        SEND_VAR_EX                                                  !1
        201        SEND_VAR_EX                                                  !12
        202        SEND_UNPACK                                                  !3
        203        CHECK_UNDEF_ARGS                                             
        204        DO_FCALL                                          1  $90     
        205        QM_ASSIGN                                            ~91     $90
        206      > JMP                                                          ->208
  131   207    >   QM_ASSIGN                                            ~91     !12
        208    >   FE_FREE                                                      $79
        209      > RETURN                                                       ~91
  121   210    > > JMP                                                          ->163
        211    >   FE_FREE                                                      $79
  135   212      > JMPZ                                                         !13, ->237
  136   213    >   FETCH_DIM_R                                          ~92     !1, 'accepted_types'
        214        FRAMELESS_ICALL_2                implode             ~93     '%2C+', ~92
        215        ASSIGN                                                       !15, ~93
  137   216        TYPE_CHECK                                      256          !12
        217      > JMPZ                                                         ~95, ->222
        218    >   GET_CLASS                                            ~96     !12
        219        CONCAT                                               ~97     'instance+of+', ~96
        220        QM_ASSIGN                                            ~98     ~97
        221      > JMP                                                          ->224
        222    >   GET_TYPE                                             ~99     !12
        223        QM_ASSIGN                                            ~98     ~99
        224    >   ASSIGN                                                       !16, ~98
  138   225        INIT_FCALL                                                   '_doing_it_wrong'
  139   226        SEND_VAL                                                     'apply_filters_typesafe'
  140   227        ROPE_INIT                                         7  ~102    'Filters+for+'
        228        ROPE_ADD                                          1  ~102    ~102, !0
        229        ROPE_ADD                                          2  ~102    ~102, '+where+expected+to+return+a+value+of+one+of+types+'
        230        ROPE_ADD                                          3  ~102    ~102, !15
        231        ROPE_ADD                                          4  ~102    ~102, '.+Got+'
        232        ROPE_ADD                                          5  ~102    ~102, !16
        233        ROPE_END                                          6  ~101    ~102, '+instead.'
        234        SEND_VAL                                                     ~101
  141   235        SEND_VAL                                                     '5.6'
  138   236        DO_FCALL                                          0          
  145   237    >   FETCH_R                          global              ~107    !0
        238      > JMPZ                                                         ~107, ->248
  146   239    >   INIT_FCALL_BY_NAME                                           'apply_filters_typesafe'
        240        SEND_VAR_EX                                                  !0
        241        SEND_VAR_EX                                                  !1
        242        SEND_VAR_EX                                                  !9
        243        SEND_UNPACK                                                  !3
        244        CHECK_UNDEF_ARGS                                             
        245        DO_FCALL                                          1  $108    
        246        QM_ASSIGN                                            ~109    $108
        247      > JMP                                                          ->249
  147   248    >   QM_ASSIGN                                            ~109    !12
        249    > > RETURN                                                       ~109
  148   250*     > RETURN                                                       null

End of function apply_filters_typesafe

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
118.89 ms | 528 KiB | 21 Q