/** * @param LType $type forced Type für den InferredType * @return LValue|LExpression */ public function value($phpValue, $type = NULL) { if ($phpValue instanceof LValue) { return $phpValue; } elseif ($phpValue instanceof LExpression) { return $phpValue; } if (!isset($type)) { $type = $this->typeInferrer->inferType($phpValue); } return new LValue($phpValue, $this->type($type)); }
public function walkPHPValue($phpValue, Type $type = NULL, $context = NULL) { $type = $type ?: $this->typeInferrer->inferType($phpValue); if ($type instanceof ArrayType) { return $this->walkArrayValue($phpValue, $type); } elseif ($this->isHashMapType($type)) { return $this->walkHashMapValue($phpValue, $type); } elseif ($phpValue instanceof Walkable) { return $this->walkElement($phpValue->getWalkableAST(), $context); } elseif ($type instanceof ObjectType) { return $this->walkObjectValue($phpValue, $type); } elseif ($phpValue === NULL && $type instanceof MixedType) { return $this->codeWriter->writeValue($phpValue, $type); } elseif ($phpValue === NULL && $type instanceof MixedType) { return $this->codeWriter->writeValue($phpValue, $type); } elseif ($type instanceof IntegerType || $type instanceof BooleanType || $type instanceof StringType || $type instanceof FloatType) { return $this->codeWriter->writeValue($phpValue, $type); } throw new \Psc\Code\NotImplementedException('Unbekannte phpValue: ' . Code::varInfo($phpValue) . ' vom Walker nicht implementiert.'); }