1
完全不清楚如何確定方法是否具有原型。如何正確確定ReflectionMethod :: getPrototype
例:
<?php
class MyClass
{
public function foo()
{
}
}
$refl = new ReflectionClass('MyClass');
var_dump($refl->getMethod('foo')->getPrototype());
輸出爲PHP 5.1.2 - 5.5.5:
Fatal error: Uncaught exception 'ReflectionException' with message 'Method MyClass::foo does not have a prototype'...
我想實現像bool ReflectionMethod::hasPrototype(void)
我ReflectionMethod包裝。
任何想法?
@Phil:我同意。但以單字節爲代價的面向未來的驗證聽起來對我來說是不容易的。 – Jon
剛剛意識到你正在做某種可能在任何地方的'ReflectionMethod'擴展。在這種情況下,好主意,但我只是進口('使用')它在頂部:) – Phil
@Jon很好的例子,謝謝!所有作品(c: – klay