3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Request {} class Route {} // Before: docs only: array|string|\Stringable|null /* interface FooInterface { public function getTitle(Request $request, Route $route); } */ // If we use native typehints instead interface FooInterface { public function getTitle(Request $request, Route $route): null|array|string|\Stringable; } // This is an implementation written against the original, i.e. with no return types specified. We should not break it. class SomeFoo implements FooInterface { public function getTitle(Request $request, Route $route) { return 'yay'; } } $test = new SomeFoo(); var_dump($test->getTitle(new Request(), new Route()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WYop7
function name:  (null)
number of ops:  16
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'somefoo'
   23     1        NEW                                              $1      'SomeFoo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   24     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getTitle'
          6        NEW                                              $4      'Request'
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $4
          9        NEW                                              $6      'Route'
         10        DO_FCALL                                      0          
         11        SEND_VAR_NO_REF_EX                                       $6
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class Request: [no user functions]
Class Route: [no user functions]
Class FooInterface:
Function gettitle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WYop7
function name:  getTitle
number of ops:  4
compiled vars:  !0 = $request, !1 = $route
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        VERIFY_RETURN_TYPE                                       
          3      > RETURN                                                   null

End of function gettitle

End of class FooInterface.

Class SomeFoo:
Function gettitle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WYop7
function name:  getTitle
number of ops:  4
compiled vars:  !0 = $request, !1 = $route
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2      > RETURN                                                   'yay'
   20     3*     > RETURN                                                   null

End of function gettitle

End of class SomeFoo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.86 ms | 1003 KiB | 14 Q