<?php
namespace My\Reflection;
class MyMethod extends \ReflectionMethod {
public function hasPrototype() {
try {
parent::getPrototype();
return true;
}
catch (\ReflectionException $e) {
return false;
}
}
public function getPrototype() {
return $this->hasPrototype() ? parent::getPrototype() : "Method {$this->getName()} does not have a prototype";
}
}
Deprecated: Return type of My\Reflection\MyMethod::getPrototype() should either be compatible with ReflectionMethod::getPrototype(): ReflectionMethod, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Itm2f on line 16
Fatal error: Declaration of My\Reflection\MyMethod::hasPrototype() must be compatible with ReflectionMethod::hasPrototype(): bool in /in/Itm2f on line 6
Process exited with code 255.
Output for 8.1.0 - 8.1.28
Deprecated: Return type of My\Reflection\MyMethod::getPrototype() should either be compatible with ReflectionMethod::getPrototype(): ReflectionMethod, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/Itm2f on line 16