3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FormStateInterface {} class FormState implements FormStateInterface {} class Config {} class ConfigFormBase { public function submitForm(array &$form, FormStateInterface $form_state) { var_dump(method_exists($this, 'mapFormValuesToConfig')); } } trait ValidatableConfigFormTrait { abstract protected static function mapFormValuesToConfig(FormStateInterface $form_state, Config $config): void; } class MyForm extends ConfigFormBase { use ValidatableConfigFormTrait; protected static function mapFormValuesToConfig(FormStateInterface $form_state, Config $config): void { // without this, PHP will complain! 👍 } } class SubMyForm extends MyForm {} $form = []; (new MyForm())->submitForm($form, new FormState()); (new SubMyForm())->submitForm($form, new FormState());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93YM6
function name:  (null)
number of ops:  21
compiled vars:  !0 = $form
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'formstate'
   17     1        DECLARE_CLASS                                            'myform', 'configformbase'
   24     2        DECLARE_CLASS                                            'submyform', 'myform'
   26     3        ASSIGN                                                   !0, <array>
   27     4        NEW                                              $2      'MyForm'
          5        DO_FCALL                                      0          
          6        INIT_METHOD_CALL                                         $2, 'submitForm'
          7        SEND_VAR_EX                                              !0
          8        NEW                                              $4      'FormState'
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $4
         11        DO_FCALL                                      0          
   28    12        NEW                                              $7      'SubMyForm'
         13        DO_FCALL                                      0          
         14        INIT_METHOD_CALL                                         $7, 'submitForm'
         15        SEND_VAR_EX                                              !0
         16        NEW                                              $9      'FormState'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $9
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Class FormStateInterface: [no user functions]
Class FormState: [no user functions]
Class Config: [no user functions]
Class ConfigFormBase:
Function submitform:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93YM6
function name:  submitForm
number of ops:  11
compiled vars:  !0 = $form, !1 = $form_state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'method_exists'
          4        FETCH_THIS                                       ~2      
          5        SEND_VAL                                                 ~2
          6        SEND_VAL                                                 'mapFormValuesToConfig'
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
   10    10      > RETURN                                                   null

End of function submitform

End of class ConfigFormBase.

Class ValidatableConfigFormTrait:
Function mapformvaluestoconfig:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93YM6
function name:  mapFormValuesToConfig
number of ops:  3
compiled vars:  !0 = $form_state, !1 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function mapformvaluestoconfig

End of class ValidatableConfigFormTrait.

Class MyForm:
Function mapformvaluestoconfig:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93YM6
function name:  mapFormValuesToConfig
number of ops:  3
compiled vars:  !0 = $form_state, !1 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2      > RETURN                                                   null

End of function mapformvaluestoconfig

End of class MyForm.

Class SubMyForm: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.36 ms | 1465 KiB | 15 Q