/** * @param MethodDefinition $method * * @return $this */ public function addMethod(MethodDefinition $method) { if (method_exists($this, 'addClassNameUse')) { foreach ($method->getParameters() as $parameter) { foreach ([$parameter->getDefaultValue(), $parameter->getType()] as $type) { if (true === $type instanceof ObjectType) { /* @var $type ObjectType */ $this->addClassNameUse($type->getClassName()); } } } } $key = $method->getName()->toLowerCamelCase(); $this->methods[$key] = $method; return $this; }