ReflectionMethod::__construct ReflectionMethod を作成する &reftitle.description; public ReflectionMethod::__construct objectstringobjectOrMethod stringmethod 代替のシグネチャ (名前付き引数をサポートしていません): public ReflectionMethod::__construct stringclassMethod この代替のシグネチャは PHP 8.4.0 以降で非推奨となりました。 代わりに ReflectionMethod::createFromMethodName を使用してください。 新しい ReflectionMethod を作成します。 &reftitle.parameters; objectOrMethod メソッドを含むクラスの名前あるいはオブジェクト (クラスのインスタンス)。 method メソッドの名前。 classMethod クラス名とメソッド名を :: で区切ったもの。 &reftitle.errors; 指定したメソッドが存在しない場合に ReflectionException が発生します。 &reftitle.examples; <methodname>ReflectionMethod::__construct</methodname> の例 The %s%s%s%s%s%s%s method '%s' (which is %s)\n" . " declared in %s\n" . " lines %d to %d\n" . " having the modifiers %d[%s]\n", $method->isInternal() ? 'internal' : 'user-defined', $method->isAbstract() ? ' abstract' : '', $method->isFinal() ? ' final' : '', $method->isPublic() ? ' public' : '', $method->isPrivate() ? ' private' : '', $method->isProtected() ? ' protected' : '', $method->isStatic() ? ' static' : '', $method->getName(), $method->isConstructor() ? 'the constructor' : 'a regular method', $method->getFileName(), $method->getStartLine(), $method->getEndline(), $method->getModifiers(), implode(' ', Reflection::getModifierNames($method->getModifiers())) ); // ドキュメントコメントを表示します printf("---> Documentation:\n %s\n", var_export($method->getDocComment(), true)); // static 変数があれば表示します if ($statics= $method->getStaticVariables()) { printf("---> Static variables: %s\n", var_export($statics, true)); } // メソッドを実行します printf("---> Invocation results in: "); var_dump($method->invoke(NULL)); ?> ]]> &example.outputs.similar; The user-defined final public static method 'increment' (which is a regular method) declared in /Users/philip/cvs/phpdoc/test.php lines 14 to 17 having the modifiers 261[final public static] ---> Documentation: '/** * カウンタをインクリメントする * * @final * @static * @access public * @return int */' ---> Invocation results in: int(1) ]]> &reftitle.seealso; ReflectionMethod::export コンストラクタ