ReflectionFunction::__constructConstruye un nuevo objeto ReflectionFunction
&reftitle.description;
publicReflectionFunction::__constructClosurestringfunction
Construye un nuevo objeto ReflectionFunction.
&reftitle.parameters;
function
El nombre de la función a reflejar o una
fermeture.
&reftitle.errors;
Se lanza una excepción ReflectionException si el argumento function
contiene una función inválida.
&reftitle.examples;
Ejemplo con ReflectionFunction::__construct
La función '%s' '%s'\n".
" declarada en %s\n".
" líneas %d a %d\n",
$func->isInternal() ? 'interna' : 'definida por el usuario',
$func->getName(),
$func->getFileName(),
$func->getStartLine(),
$func->getEndline()
);
// Muestra los comentarios de documentación
printf("---> Documentación:\n %s\n", var_export($func->getDocComment(), 1));
// Muestra las variables estáticas existentes
if ($statics = $func->getStaticVariables())
{
printf("---> Variables estáticas: %s\n", var_export($statics, 1));
}
}
// Crear una instancia de la clase ReflectionFunction
dumpReflectionFunction(new ReflectionFunction('counter1'));
dumpReflectionFunction(new ReflectionFunction($counter2));
?>
]]>
&example.outputs.similar;
La función definida por el usuario 'counter1'
declarada en Z:\reflectcounter.php
líneas 7 a 11
---> Documentación:
'/**
* A simple counter
*
* @return int
*/'
---> Variables estáticas: array (
'c' => 0,
)
===> La función definida por el usuario '{closure}'
declarada en Z:\reflectcounter.php
líneas 18 a 23
---> Documentación:
'/**
* Another simple counter
*
* @return int
*/'
---> Variables estáticas: array (
'd' => 0,
)
]]>
&reftitle.seealso;
ReflectionMethod::__constructLos constructores