php-parser/test/code/prettyPrinter/stmt/property_promotion.test
2021-08-08 19:12:44 +02:00

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"
)
{
}
}