getNativeType() public method

Gets the native type with the supplied int from the INativeType::TYPE_* constants.
public getNativeType ( string $nativeType ) : Pinq\Analysis\INativeType
$nativeType string
return Pinq\Analysis\INativeType
Example #1
0
 public function visitClosure(O\ClosureExpression $expression)
 {
     $originalContext = $this->analysisContext;
     $this->analysisContext = $originalContext->inNewScope();
     foreach ($expression->getParameters() as $parameter) {
         $this->walk($parameter);
         $typeHintType = $this->typeSystem->getTypeFromTypeHint($parameter->getTypeHint());
         if (!$parameter->hasDefaultValue() || $this->analysis[$parameter->getDefaultValue()]->isEqualTo($typeHintType)) {
             $this->analysisContext->setExpressionType($parameter->asVariable(), $typeHintType);
         } else {
             $this->analysisContext->setExpressionType($parameter->asVariable(), $this->typeSystem->getNativeType(INativeType::TYPE_MIXED));
         }
     }
     foreach ($expression->getUsedVariables() as $usedVariable) {
         $variable = $usedVariable->asVariable();
         //TODO: handle references with used variables. Probably impossible though.
         $this->analysisContext->setExpressionType($variable, $originalContext->getExpressionType($variable));
     }
     $this->walkAll($expression->getBodyExpressions());
     $this->analysis[$expression] = $this->typeSystem->getObjectType('Closure');
     $this->analysisContext = $originalContext;
 }
 protected function assertReturnsNativeType(callable $expression, $nativeType, array $variableTypeMap = [])
 {
     $this->assertReturnsType($expression, $this->typeSystem->getNativeType($nativeType), $variableTypeMap);
 }