Catch the correct Exception when matching return type transforms
MODIFY
src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
@@ -17,6 +17,7 @@ use Behat\Testwork\Call\CallCenter;
use Behat\Testwork\Call\RuntimeCallee;
use Closure;
use ReflectionClass;
+use ReflectionException;
use ReflectionFunctionAbstract;
use ReflectionMethod;
use ReflectionParameter;
@@ -231,7 +232,7 @@ final class ReturnTypeTransformation extends RuntimeCallee implements SimpleArgu
try {
return new ReflectionClass($t->getName());
}
- catch (\TypeError $t) {
+ catch (ReflectionException $t) {
return null;
}
}

Catch the correct Exception when matching return type transforms