php-parser/test/code/prettyPrinter/stmt/attributes.test
Tomas Votruba 4c22c62783
[PHP 8.0] Add attributes support (#661)
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes
containing `Attribute` nodes. The `attrGroup` subnode is added to all
nodes that can have attributes.

This is still missing FPPP support.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-09-13 21:01:17 +02:00

61 lines
587 B
Plaintext

Attributes
-----
<?php
#[
A1,
A2(),
A3(0),
A4(x: 1),
]
function a() {
}
#[A5]
class C {
#[A6]
public function m(
#[A7] $param,
) {}
#[A12]
public $prop;
}
#[A8]
interface I {}
#[A9]
trait T {}
$x = #[A10] function() {};
$y = #[A11] fn() => 0;
new #[A13] class {};
-----
!!php7
#[A1, A2, A3(0), A4(x: 1)]
function a()
{
}
#[A5]
class C
{
#[A6]
public function m(#[A7] $param)
{
}
#[A12]
public $prop;
}
#[A8]
interface I
{
}
#[A9]
trait T
{
}
$x = #[A10] function () {
};
$y = #[A11] fn() => 0;
new #[A13] class
{
};