ReflectionProperty_isDefault_basic.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Test ReflectionProperty::isDefault() usage.
  3. --FILE--
  4. <?php
  5. function reflectProperty($class, $property) {
  6. $propInfo = new ReflectionProperty($class, $property);
  7. echo "**********************************\n";
  8. echo "Reflecting on property $class::$property\n\n";
  9. echo "isDefault():\n";
  10. var_dump($propInfo->isDefault());
  11. echo "\n**********************************\n";
  12. }
  13. class TestClass {
  14. public $pub;
  15. static public $stat = "static property";
  16. protected $prot = 4;
  17. private $priv = "keepOut";
  18. }
  19. reflectProperty("TestClass", "pub");
  20. reflectProperty("TestClass", "stat");
  21. reflectProperty("TestClass", "prot");
  22. reflectProperty("TestClass", "priv");
  23. ?>
  24. --EXPECT--
  25. **********************************
  26. Reflecting on property TestClass::pub
  27. isDefault():
  28. bool(true)
  29. **********************************
  30. **********************************
  31. Reflecting on property TestClass::stat
  32. isDefault():
  33. bool(true)
  34. **********************************
  35. **********************************
  36. Reflecting on property TestClass::prot
  37. isDefault():
  38. bool(true)
  39. **********************************
  40. **********************************
  41. Reflecting on property TestClass::priv
  42. isDefault():
  43. bool(true)
  44. **********************************