Added ClassName::fromObject method and companion test case.

So, if you update this PR to remove the changes to `composer.json` and `composer.lock`, I can look into merging it for you :)