Added usage of reflection factory

This PR fixes PHPSpec tests.