3v4l.org

run code in 500+ PHP versions simultaneously
<?php abstract class A { abstract public function test(A $foo): self; } class B extends A { public function test(A $foo): self { return $this; } } $foo = new B(); var_dump($foo, $foo->test($foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPjvg
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   NEW                                                  $1      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   15     3        INIT_FCALL                                                   'var_dump'
          4        SEND_VAR                                                     !0
          5        INIT_METHOD_CALL                                             !0, 'test'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0  $4      
          8        SEND_VAR                                                     $4
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

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

End of function test

End of class A.

Class B:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPjvg
function name:  test
number of ops:  6
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
   10     1        FETCH_THIS                                           ~1      
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
   11     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.17 ms | 2152 KiB | 13 Q