mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-12 09:09:41 +01:00
4c22c62783
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>
61 lines
587 B
Plaintext
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
|
|
{
|
|
}; |