mirror of
https://github.com/php/php-src.git
synced 2026-03-26 17:22:15 +01:00
Implement printing for ReflectionAttribute. Attributes aren't printed as part of reflection output for other structures (classes etc) yet. Closes GH-6117.
27 lines
492 B
PHP
27 lines
492 B
PHP
--TEST--
|
|
ReflectionAttribute::__toString
|
|
--FILE--
|
|
<?php
|
|
|
|
#[Foo, Bar(a: "foo", b: 1234), Baz("foo", 1234)]
|
|
function foo() {}
|
|
|
|
$refl = new ReflectionFunction('foo');
|
|
echo $refl->getAttributes()[0];
|
|
echo $refl->getAttributes()[1];
|
|
echo $refl->getAttributes()[2];
|
|
--EXPECTF--
|
|
Attribute [ Foo ]
|
|
Attribute [ Bar ] {
|
|
- Arguments [2] {
|
|
Argument #0 [ a = 'foo' ]
|
|
Argument #1 [ b = 1234 ]
|
|
}
|
|
}
|
|
Attribute [ Baz ] {
|
|
- Arguments [2] {
|
|
Argument #0 [ 'foo' ]
|
|
Argument #1 [ 1234 ]
|
|
}
|
|
}
|