1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/ext/reflection/tests/ReflectionAttribute_toString.phpt
Benjamin Eberlei bc39abe8c3 Fix #80097: Have ReflectionAttribute implement Reflector and __toString
Implement printing for ReflectionAttribute. Attributes aren't
printed as part of reflection output for other structures (classes
etc) yet.

Closes GH-6117.
2021-07-07 12:42:04 +02:00

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 ]
}
}