mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-04 10:28:18 +01:00
9aebf377fc
Fixes issue #800.
51 lines
829 B
Plaintext
51 lines
829 B
Plaintext
Property promotion
|
|
-----
|
|
<?php
|
|
|
|
class Point
|
|
{
|
|
public function __construct(
|
|
public float $x = 0.0,
|
|
protected array $y = [],
|
|
private string $z = 'hello',
|
|
public readonly int $a = 0,
|
|
) {
|
|
}
|
|
}
|
|
-----
|
|
!!php7
|
|
class Point
|
|
{
|
|
public function __construct(public float $x = 0.0, protected array $y = [], private string $z = 'hello', public readonly int $a = 0)
|
|
{
|
|
}
|
|
}
|
|
-----
|
|
<?php
|
|
class Test
|
|
{
|
|
public $z;
|
|
public function __construct(
|
|
public int $x,
|
|
/** @SomeAnnotation() */
|
|
public string $y = "123",
|
|
string $z = "abc"
|
|
)
|
|
{
|
|
}
|
|
}
|
|
-----
|
|
!!php7
|
|
class Test
|
|
{
|
|
public $z;
|
|
public function __construct(
|
|
public int $x,
|
|
/** @SomeAnnotation() */
|
|
public string $y = "123",
|
|
string $z = "abc"
|
|
)
|
|
{
|
|
}
|
|
}
|