3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SupportSystemConfiguration { protected $_supportSystemConfiguration; public function getConfig() : Config { return $this->_supportSystemConfiguration; } public function setConfig( Config $supportSystemConfiguration ) : void { $this->_supportSystemConfiguration = $supportSystemConfiguration; } } class Config { public $dbName; public function __construct(string $dbName) { $this->dbName = $dbName; } } class Foo { use SupportSystemConfiguration; public function __construct(Config $supportSystemConfig) { $this->setConfig( $supportSystemConfig ); } public function displayCheck() : void {} } class Baz { use SupportSystemConfiguration; public function __construct(Config $supportSystemConfig ) { $this->setConfig( $supportSystemConfig ); } public function performCheck() : string { $objFoo = new Foo( $this->getConfig() ); $objFoo->displayCheck(); return 'ok'; } } $objSupportSystemConfiguration = new Config('abc'); $objFuzz = new Baz( $objSupportSystemConfiguration ); echo $objFuzz->performCheck();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $objSupportSystemConfiguration, !1 = $objFuzz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   DECLARE_CLASS                                            'foo'
   37     1        DECLARE_CLASS                                            'baz'
   56     2        NEW                                              $2      'Config'
          3        SEND_VAL_EX                                              'abc'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   58     6        NEW                                              $5      'Baz'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
   60    10        INIT_METHOD_CALL                                         !1, 'performCheck'
         11        DO_FCALL                                      0  $8      
         12        ECHO                                                     $8
         13      > RETURN                                                   1

Class SupportSystemConfiguration:
Function getconfig:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  getConfig
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      '_supportSystemConfiguration'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
          3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getconfig

Function setconfig:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  setConfig
number of ops:  4
compiled vars:  !0 = $supportSystemConfiguration
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               '_supportSystemConfiguration'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setconfig

End of class SupportSystemConfiguration.

Class Config:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $dbName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        ASSIGN_OBJ                                               'dbName'
          2        OP_DATA                                                  !0
   22     3      > RETURN                                                   null

End of function __construct

End of class Config.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  __construct
number of ops:  5
compiled vars:  !0 = $supportSystemConfig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   31     1        INIT_METHOD_CALL                                         'setConfig'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   32     4      > RETURN                                                   null

End of function __construct

Function displaycheck:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  displayCheck
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E > > RETURN                                                   null

End of function displaycheck

End of class Foo.

Class Baz:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  __construct
number of ops:  5
compiled vars:  !0 = $supportSystemConfig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   43     1        INIT_METHOD_CALL                                         'setConfig'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   44     4      > RETURN                                                   null

End of function __construct

Function performcheck:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nTUQ
function name:  performCheck
number of ops:  11
compiled vars:  !0 = $objFoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $1      'Foo'
          1        INIT_METHOD_CALL                                         'getConfig'
          2        DO_FCALL                                      0  $2      
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   49     6        INIT_METHOD_CALL                                         !0, 'displayCheck'
          7        DO_FCALL                                      0          
   51     8      > RETURN                                                   'ok'
   52     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function performcheck

End of class Baz.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.46 ms | 1399 KiB | 13 Q