ReflectionAttribute_toString.phpt 742 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. ReflectionAttribute::__toString
  3. --FILE--
  4. <?php
  5. #[Foo, Bar(a: "foo", b: 1234), Baz("foo", 1234), X(NO_ERROR), Y(new stdClass)]
  6. function foo() {}
  7. $refl = new ReflectionFunction('foo');
  8. echo $refl->getAttributes()[0];
  9. echo $refl->getAttributes()[1];
  10. echo $refl->getAttributes()[2];
  11. echo $refl->getAttributes()[3];
  12. echo $refl->getAttributes()[4];
  13. ?>
  14. --EXPECT--
  15. Attribute [ Foo ]
  16. Attribute [ Bar ] {
  17. - Arguments [2] {
  18. Argument #0 [ a = 'foo' ]
  19. Argument #1 [ b = 1234 ]
  20. }
  21. }
  22. Attribute [ Baz ] {
  23. - Arguments [2] {
  24. Argument #0 [ 'foo' ]
  25. Argument #1 [ 1234 ]
  26. }
  27. }
  28. Attribute [ X ] {
  29. - Arguments [1] {
  30. Argument #0 [ NO_ERROR ]
  31. }
  32. }
  33. Attribute [ Y ] {
  34. - Arguments [1] {
  35. Argument #0 [ new \stdClass() ]
  36. }
  37. }