cretz / pratphall

A typed language targeting PHP (abandoned)
http://cretz.github.io/pratphall/
Other
45 stars 5 forks source link

Using "new" for arrays isn't considered safe for property defaults #3

Closed cretz closed 11 years ago

cretz commented 11 years ago

This:

class Test {
  arrayWithNewSyntax = new string[];
  arrayWithoutNewSyntax: string[] = [];
}

Becomes:

class Test {
    public $arrayWithNewSyntax;

    public $arrayWithoutNewSyntax = [];

    public function __construct() {
        $this->arrayWithNewSyntax = [];
    }
}