Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TSPHP does not support the type aliases boolean, integer, double and double real. They can not be used as type for a variable, type of a return value etc. nor in a cast. The following examples would all cause a compiler error.

Code Block
languagephp
titleWould cause a compiler error
boolean $a = true; //unknown type boolean
integer $b = 1;    //unknown type integer
double $c = 1.2;   //unknown type double
real $d = 2.5;     //unknown type double

bool $d$e = (boolean) $e$f;  //unknown type boolean
int $f$g = (integer) $g$h;   //unknown type integer
float $h$i = (double) $i$j;  //unknown type double
float $k = (real) $l;    //unknown type real

function void setStatus(boolean $status){}       //unknown type boolean
function void setQuantity(integer $quantity){}   //unknown type integer
function void setPrice(double $price){}          //unknown type double
function void setPrice(real $price){}            //unknown type real

//etc.

Case sensitive class/method/function names

...