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): mixed; } interface ReturnI extends Base { public function foo(AlmostNever $x): I; } interface AcceptI extends Base { public function foo(I $x): mixed; } class AcceptReturnI implements AcceptI, ReturnI { public function foo(I $x): I { return $x; } } function f(AcceptI&ReturnI $callme, I $x): I { return $callme->foo($x); } f(new AcceptReturnI(), new C());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dPbgt
function name:  (null)
number of ops:  14
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                                                'acceptreturni'
   32     5        INIT_FCALL                                                   'f'
          6        NEW                                                  $0      'AcceptReturnI'
          7        DO_FCALL                                          0          
          8        SEND_VAR                                                     $0
          9        NEW                                                  $2      'C'
         10        DO_FCALL                                          0          
         11        SEND_VAR                                                     $2
         12        DO_FCALL                                          0          
         13      > RETURN                                                       1

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

End of function foo

End of class AcceptI.

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

End of function foo

End of class AcceptReturnI.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.7 ms | 1572 KiB | 14 Q