function ClassCodeGenerator::generateMethod
1 call to ClassCodeGenerator::generateMethod()
- ClassCodeGenerator::generate in vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ Generator/ ClassCodeGenerator.php - Generates PHP code for class node.
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ Generator/ ClassCodeGenerator.php, line 64
Class
- ClassCodeGenerator
- Class code creator. Generates PHP code for specific class node tree.
Namespace
Prophecy\Doubler\GeneratorCode
private function generateMethod(Node\MethodNode $method) : string {
$php = sprintf("%s %s function %s%s(%s)%s {\n", $method->getVisibility(), $method->isStatic() ? 'static' : '', $method->returnsReference() ? '&' : '', $method->getName(), implode(', ', $this->generateArguments($method->getArguments())), ($ret = $this->generateTypes($method->getReturnTypeNode())) ? ': ' . $ret : '');
$php .= $method->getCode() . "\n";
return $php . '}';
}