3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Store { public function fetch(): Record; } interface Record {} class FooStore { public function __construct($conn) { $this->conn = $conn; } public function fetch(): FooRecord { $data = $this->conn->fetch(); return new FooRecord($data); } } class FooRecord { public function __construct($data) { $this->data = $data; } } class XmlFormatter { public function FooRecordToXml(Store $fooStore): FooXml { $fooRecord = $fooStore->fetch(); return new FooXml($fooRecord); } } class FooXml { public function __construct(FooRecord $record) { $this->record = $record; } public function output(): string { return "<FooRecord>{$this->record}</FooRecord>"; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E > > RETURN                                                   1

Class Store:
Function fetch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  fetch
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 fetch

End of class Store.

Class Record: [no user functions]
Class FooStore:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  __construct
number of ops:  4
compiled vars:  !0 = $conn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               'conn'
          2        OP_DATA                                                  !0
   15     3      > RETURN                                                   null

End of function __construct

Function fetch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  fetch
number of ops:  11
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~1      'conn'
          1        INIT_METHOD_CALL                                         ~1, 'fetch'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   20     4        NEW                                              $4      'FooRecord'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        VERIFY_RETURN_TYPE                                       $4
          8      > RETURN                                                   $4
   21     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function fetch

End of class FooStore.

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

End of function __construct

End of class FooRecord.

Class XmlFormatter:
Function foorecordtoxml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  FooRecordToXml
number of ops:  11
compiled vars:  !0 = $fooStore, !1 = $fooRecord
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        INIT_METHOD_CALL                                         !0, 'fetch'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
   37     4        NEW                                              $4      'FooXml'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
          7        VERIFY_RETURN_TYPE                                       $4
          8      > RETURN                                                   $4
   38     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function foorecordtoxml

End of class XmlFormatter.

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

End of function __construct

Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g99QA
function name:  output
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   ROPE_INIT                                     3  ~2      '%3CFooRecord%3E'
          1        FETCH_OBJ_R                                      ~0      'record'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%3C%2FFooRecord%3E'
          4        VERIFY_RETURN_TYPE                                       ~1
          5      > RETURN                                                   ~1
   51     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function output

End of class FooXml.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.85 ms | 944 KiB | 14 Q