ReflectionFunction::__constructConstrói um objeto ReflectionFunction
&reftitle.description;
publicReflectionFunction::__constructClosurestringfunction
Constrói um objeto ReflectionFunction.
&reftitle.parameters;
function
O nome da função a ser refletida ou uma closure.
&reftitle.errors;
Uma ReflectionException se o parâmetro function
não contém uma função válida.
&reftitle.examples;
Exemplo de ReflectionFunction::__construct
A função do tipo %s '%s'\n".
" declarada em %s\n".
" linhas %d a %d\n",
$func->isInternal() ? 'internal' : 'user-defined',
$func->getName(),
$func->getFileName(),
$func->getStartLine(),
$func->getEndline()
);
// Exibe comentário de documentação documentation comment
printf("---> Documentação:\n %s\n", var_export($func->getDocComment(), 1));
// Exibe variáveis estáticas se existirem
if ($statics = $func->getStaticVariables())
{
printf("---> Variáveis estáticas: %s\n", var_export($statics, 1));
}
}
// Cria uma instância da classe ReflectionFunction
dumpReflectionFunction(new ReflectionFunction('counter1'));
dumpReflectionFunction(new ReflectionFunction($counter2));
?>
]]>
&example.outputs.similar;
A função do tipo user-defined 'counter1'
declarada em Z:\reflectcounter.php
linhas 7 a 11
---> Documentação
'/**
* Um contador simples
*
* @return int
*/'
---> Variáveis estáticas: array (
'c' => 0,
)
===> A função do tipo user-defined '{closure}'
declarada em Z:\reflectcounter.php
linhas 18 a 23
---> Documentação
'/**
* Outro contador simples
*
* @return int
*/'
---> Static variables: array (
'd' => 0,
)
]]>
&reftitle.seealso;
ReflectionMethod::__constructConstrutores