FunctionDeclarationNode::cloneAsMethodOf()

This is a convenience method that would come in very handy for DMU, and probably for other people: the ability to clone a function declaration as a method of an existing class. It's just a convenience method, really, around ClassMethodNode::fromFunction, appending the result to an existing class.

I implemented this with a test, but I had to add a small sanity check to ClassMethodNode::fromFunction in order to get the test to pass, so that's why I'm submitting a PR.