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) { print "original"; } } trait ValidatableConfigFormTrait { abstract protected static function mapFormValuesToConfig(FormStateInterface $form_state, Config $config): void; public function submitForm(array &$form, FormStateInterface $form_state) { print "trait"; } } class MyForm extends ConfigFormBase { use ValidatableConfigFormTrait; protected static function mapFormValuesToConfig(FormStateInterface $form_state, Config $config): void { // without this, PHP will complain! 👍 } } $form = []; (new MyForm())->submitForm($form, new FormState());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ASMl2
function name:  (null)
number of ops:  12
compiled vars:  !0 = $form
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'formstate'
   20     1        DECLARE_CLASS                                            'myform', 'configformbase'
   28     2        ASSIGN                                                   !0, <array>
   29     3        NEW                                              $2      'MyForm'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $2, 'submitForm'
          6        SEND_VAR_EX                                              !0
          7        NEW                                              $4      'FormState'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0          
         11      > 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/ASMl2
function name:  submitForm
number of ops:  4
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        ECHO                                                     'original'
   10     3      > 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/ASMl2
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

Function submitform:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ASMl2
function name:  submitForm
number of ops:  4
compiled vars:  !0 = $form, !1 = $form_state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        ECHO                                                     'trait'
   17     3      > RETURN                                                   null

End of function submitform

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/ASMl2
function name:  mapFormValuesToConfig
number of ops:  3
compiled vars:  !0 = $form_state, !1 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2      > RETURN                                                   null

End of function mapformvaluestoconfig

End of class MyForm.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.25 ms | 1434 KiB | 13 Q