3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { const int FOO = 42; } /** * @psalm-require-extends Foo */ trait Bar { public function foo(): int { return static::FOO; } } class Baz extends Foo { use Bar; } $baz = new Baz(); var_dump($baz->foo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ntb8
function name:  (null)
number of ops:  10
compiled vars:  !0 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                            'baz', 'foo'
   22     1        NEW                                              $1      'Baz'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   23     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'foo'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class Foo: [no user functions]
Class Bar:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Ntb8
function name:  foo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_CLASS_CONSTANT                             ~0      'FOO'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   15     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function foo

End of class Bar.

Class Baz: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.73 ms | 1013 KiB | 14 Q