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";
Output for 8.4.1 - 8.4.14
Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in /in/pf4lE on line 13 Signature 1 called in a child class, deprecated since 8.4: 1 Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in /in/pf4lE on line 13 ReflectionMethod not called directly, triggers deprecation on Foo indirectly, checking Bar is out of scope for sniff: 1
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27
Signature 1 called in a child class, deprecated since 8.4: 1 ReflectionMethod not called directly, triggers deprecation on Foo indirectly, checking Bar is out of scope for sniff: 1

preferences:
51.93 ms | 408 KiB | 5 Q