3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DoerInterface { public function doit(): self; } class MainDoer implements DoerInterface { public function doit(): self { echo 'main'; return $this; } } class ProxyDoer { private DoerInterface $decorated; public function __construct(DoerInterface $decorated) { $this->decorated = $decorated; } public function doit(): self { echo 'decorated'; return new self($this->decorated->doit()); } } $doer = new ProxyDoer(new MainDoer()); $doer->doit();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WD9SJ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $doer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'maindoer'
   33     1        NEW                                              $1      'ProxyDoer'
          2        NEW                                              $2      'MainDoer'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   34     7        INIT_METHOD_CALL                                         !0, 'doit'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

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

End of function doit

End of class DoerInterface.

Class MainDoer:
Function doit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WD9SJ
function name:  doit
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'main'
   13     1        FETCH_THIS                                       ~0      
          2        VERIFY_RETURN_TYPE                                       ~0
          3      > RETURN                                                   ~0
   14     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function doit

End of class MainDoer.

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

End of function __construct

Function doit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WD9SJ
function name:  doit
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'decorated'
   29     1        NEW                          self                $0      
          2        FETCH_OBJ_R                                      ~1      'decorated'
          3        INIT_METHOD_CALL                                         ~1, 'doit'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0          
          7        VERIFY_RETURN_TYPE                                       $0
          8      > RETURN                                                   $0
   30     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function doit

End of class ProxyDoer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.07 ms | 1007 KiB | 13 Q