bug78774.phpt 543 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #78774: ReflectionNamedType on Typed Properties Crash
  3. --FILE--
  4. <?php
  5. class Test {
  6. public stdClass $prop;
  7. public stdClass|Foo $prop2;
  8. }
  9. $rc = new ReflectionClass(Test::class);
  10. $rp = $rc->getProperty('prop');
  11. $rt = $rp->getType();
  12. $rp2 = $rc->getProperty('prop2');
  13. $rt2 = $rp2->getType();
  14. // Force a resolution of the property type
  15. $test = new Test;
  16. $test->prop = new stdClass;
  17. $test->prop2 = new stdClass;
  18. var_dump($rt->getName());
  19. var_dump((string) $rt2);
  20. ?>
  21. --EXPECT--
  22. string(8) "stdClass"
  23. string(12) "stdClass|Foo"