title: PHP: Is there a way to get the return type of a method?
body: <p>Given the following code structure is there a way that I can get the return type of FooFactory->createService method with PHP 5.6? I've tried ReflectionClass and ReflectionMethod classes but couldn't find a way.Thanks in advance. </p>
  
  <pre><code>class FooFactory implements FactoryInterface {
      public function createService(/*args*/)
      {
          $foo = new Foo();
          // ...
          //inject dependencies
          // ...
          return $foo;
      }
  }
  
  class Foo {
      /*...methods...*/
  }
  </code></pre>
  
  <p>Edit: I need to get the class name without creating an instance of the FooFactory.</p>