3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { function myMethod() {} } class Foo extends ReflectionMethod { // Note: PHP never requires a child's constructor signature to match the parent's, so we don't need to sniff for that public function __construct() { parent::__construct('MyClass::myMethod'); } } $method = new Foo(); echo 'Signature 1 called in a child class, deprecated since 8.4: ' . $method->isPublic() . "\n"; class Bar extends Foo // 2 levels of inheritance { public function __construct() { parent::__construct(); } } $method = new Bar(); echo 'ReflectionMethod not called directly, triggers deprecation on Foo indirectly, checking Bar is out of scope for sniff: ' . $method->isPublic() . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pf4lE
function name:  (null)
number of ops:  17
compiled vars:  !0 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'isPublic'
          4        DO_FCALL                                      0  $4      
          5        CONCAT                                           ~5      'Signature+1+called+in+a+child+class%2C+deprecated+since+8.4%3A+', $4
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
   28     8        NEW                                              $7      'Bar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $7
   29    11        INIT_METHOD_CALL                                         !0, 'isPublic'
         12        DO_FCALL                                      0  $10     
         13        CONCAT                                           ~11     'ReflectionMethod+not+called+directly%2C+triggers+deprecation+on+Foo+indirectly%2C+checking+Bar+is+out+of+scope+for+sniff%3A+', $10
         14        CONCAT                                           ~12     ~11, '%0A'
         15        ECHO                                                     ~12
         16      > RETURN                                                   1

Class MyClass:
Function mymethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pf4lE
function name:  myMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function mymethod

End of class MyClass.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pf4lE
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        SEND_VAL_EX                                              'MyClass%3A%3AmyMethod'
          2        DO_FCALL                                      0          
   14     3      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pf4lE
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   25     2      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.88 ms | 1000 KiB | 13 Q