-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello,
Several of our in-house modules are no-longer backwards compatible with PHP 5.x. A lot of our modules have been upgraded to take advantage of certain changes and features introduced in PHP 7.x. Currently, we try to be compliant up to PHP 7.4.x which introduced typed properties. We have discovered that Coder Upgrade w/ Grammar Parser 1.x does not support typed properties and the conversion result ends up being syntactically incorrect.
Original Code Example:
class MyInteger {
public int $my_integer;
protected ?bool $plus_one = FALSE;
public function __construct($my_integer, $plus_one) {
$this->my_integer = $my_integer;
$this->plus_one = $plus_one;
}
public function get_my_integer() {
$my_integer = $this->my_integer;
if ($this->plus_one) {
$my_integer += 1;
}
return $my_integer;
}
}
Converted Code:
class MyInteger {
public int $my_integer;
public protected bool $plus_one = FALSE;
public protected public function __construct($my_integer, $plus_one) {
$this->my_integer = $my_integer;
$this->plus_one = $plus_one;
}
public function get_my_integer() {
$my_integer = $this->my_integer;
if ($this->plus_one) {
$my_integer += 1;
}
return $my_integer;
}
}
We have a fork in progress that addresses this issue and we will be submitting a PR for this issue soon.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels