public function fromType(ReflectionType $type)
{
if ($type->allowsNull()) {
return null;
}
$typeName = strval($type);
switch (strtolower($typeName)) {
case 'bool':
case 'hh\\bool':
return false;
case 'int':
case 'hh\\int':
return 0;
case 'float':
case 'hh\\float':
return 0.0;
case 'string':
case 'hh\\string':
return '';
case 'array':
case 'iterable':
return array();
case 'stdclass':
return (object) array();
case 'callable':
return $this->stubVerifierFactory->create();
case 'closure':
return function () {
};
case 'generator':
$fn = function () {
return;
yield;
};
return $fn();
// @codeCoverageIgnoreStart
// @codeCoverageIgnoreStart
case 'void':
case 'hh\\mixed':
return null;
}
// @codeCoverageIgnoreEnd
return $this->mockBuilderFactory->create($typeName)->full();
}