3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface I {} interface J {} // Simulate a "never" parameter type. interface AlmostNever extends I, J {} class C implements I {} interface Base { public function foo(AlmostNever $x, AlmostNever $y): mixed; } interface ReturnI extends Base { public function foo(AlmostNever $x, AlmostNever $y): I; } interface AcceptI extends Base { public function foo(I $x, AlmostNever $y): mixed; } interface AcceptSecondI extends Base { public function foo(AlmostNever $x, I $y): mixed; } class AcceptReturnI implements ReturnI, AcceptI, AcceptSecondI { public function foo(I $x, I $y): I { return $x; } } function f(AcceptI&AcceptSecondI&ReturnI $callme, I $x): I { return $callme->foo($x, $x); } f(new AcceptReturnI(), new C(), new C());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                                'almostnever'
    7     1        DECLARE_CLASS                                                'c'
   13     2        DECLARE_CLASS                                                'returni'
   17     3        DECLARE_CLASS                                                'accepti'
   21     4        DECLARE_CLASS                                                'acceptsecondi'
   25     5        DECLARE_CLASS                                                'acceptreturni'
   36     6        INIT_FCALL                                                   'f'
          7        NEW                                                  $0      'AcceptReturnI'
          8        DO_FCALL                                          0          
          9        SEND_VAR                                                     $0
         10        NEW                                                  $2      'C'
         11        DO_FCALL                                          0          
         12        SEND_VAR                                                     $2
         13        NEW                                                  $4      'C'
         14        DO_FCALL                                          0          
         15        SEND_VAR                                                     $4
         16        DO_FCALL                                          0          
         17      > RETURN                                                       1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  f
number of ops:  10
compiled vars:  !0 = $callme, !1 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   32     2        INIT_METHOD_CALL                                             !0, 'foo'
          3        SEND_VAR_EX                                                  !1
          4        SEND_VAR_EX                                                  !1
          5        DO_FCALL                                          0  $2      
          6        VERIFY_RETURN_TYPE                                           $2
          7      > RETURN                                                       $2
   33     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function f

Class I: [no user functions]
Class J: [no user functions]
Class AlmostNever: [no user functions]
Class C: [no user functions]
Class Base:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  foo
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function foo

End of class Base.

Class ReturnI:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  foo
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function foo

End of class ReturnI.

Class AcceptI:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  foo
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function foo

End of class AcceptI.

Class AcceptSecondI:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  foo
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function foo

End of class AcceptSecondI.

Class AcceptReturnI:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l8eG6
function name:  foo
number of ops:  6
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   27     2        VERIFY_RETURN_TYPE                                           !0
          3      > RETURN                                                       !0
   28     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function foo

End of class AcceptReturnI.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.51 ms | 1564 KiB | 14 Q