3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); trait ControlHelper { public const CONTROL_TEST = 'test'; public function getControl(string $name = self::CONTROL_TEST): void { } } interface ControlInterface { public const CONTROL_TEST = 'test'; public function getControl(string $name = self::CONTROL_TEST): void; } abstract class BasePresenter implements ControlInterface { use ControlHelper; } class Presenter extends BasePresenter { } $method = new ReflectionMethod(ControlHelper::class, 'getControl'); foreach ($method->getParameters() as $param) { $tmp = $param->getDefaultValue(); var_dump($tmp); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/s8ofg
function name:  (null)
number of ops:  20
compiled vars:  !0 = $method, !1 = $param, !2 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_CLASS                                            'basepresenter'
   23     1        DECLARE_CLASS                                            'presenter', 'basepresenter'
   28     2        NEW                                              $3      'ReflectionMethod'
          3        SEND_VAL_EX                                              'ControlHelper'
          4        SEND_VAL_EX                                              'getControl'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   29     7        INIT_METHOD_CALL                                         !0, 'getParameters'
          8        DO_FCALL                                      0  $6      
          9      > FE_RESET_R                                       $7      $6, ->18
         10    > > FE_FETCH_R                                               $7, !1, ->18
   30    11    >   INIT_METHOD_CALL                                         !1, 'getDefaultValue'
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !2, $8
   31    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
   29    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $7
   32    19      > RETURN                                                   1

Class ControlHelper:
Function getcontrol:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s8ofg
function name:  getControl
number of ops:  2
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <const ast>
    9     1      > RETURN                                                   null

End of function getcontrol

End of class ControlHelper.

Class ControlInterface:
Function getcontrol:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s8ofg
function name:  getControl
number of ops:  2
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV_INIT                                        !0      <const ast>
          1      > RETURN                                                   null

End of function getcontrol

End of class ControlInterface.

Class BasePresenter: [no user functions]
Class Presenter: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.91 ms | 1081 KiB | 14 Q