3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ProductBase {} class Product extends ProductBase {} class ProductBlank extends ProductBase {} abstract class QuantityLineProductBase { /** * Contract: will always return some kind of ProductBase */ abstract public function getProduct(): ProductBase; } class QuantityLineProductProduct extends QuantityLineProductBase { private Product $product; /** * Constructor doesn't need to obey substitution principles */ public function __construct(Product $product) { $this->product = $product; } /** * Covariance of output; no violation */ public function getProduct(): Product { return $this->product; } } class QuantityLineProductBlank extends QuantityLineProductBase { private ProductBlank $product; /** * Constructor accepting a different type; no violation */ public function __construct(ProductBlank $product) { $this->product = $product; } /** * Covariance of output; no violation */ public function getProduct(): ProductBlank { return $this->product; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aVrWS
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E > > RETURN                                                   1

Class ProductBase: [no user functions]
Class Product: [no user functions]
Class ProductBlank: [no user functions]
Class QuantityLineProductBase:
Function getproduct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aVrWS
function name:  getProduct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function getproduct

End of class QuantityLineProductBase.

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

End of function __construct

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

End of function getproduct

End of class QuantityLineProductProduct.

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

End of function __construct

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

End of function getproduct

End of class QuantityLineProductBlank.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
124.92 ms | 1012 KiB | 13 Q