You are here

public function MethodNode::setReturnType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php \Prophecy\Doubler\Generator\Node\MethodNode::setReturnType()

Parameters

string $type:

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php, line 112

Class

MethodNode
Method node.

Namespace

Prophecy\Doubler\Generator\Node

Code

public function setReturnType($type = null) {
  switch ($type) {
    case '':
      $this->returnType = null;
      break;
    case 'string':
    case 'float':
    case 'int':
    case 'bool':
    case 'array':
    case 'callable':
      $this->returnType = $type;
      break;
    case 'double':
    case 'real':
      $this->returnType = 'float';
      break;
    case 'boolean':
      $this->returnType = 'bool';
      break;
    case 'integer':
      $this->returnType = 'int';
      break;
    default:
      $this->returnType = '\\' . ltrim($type, '\\');
  }
}