Files
php-src/ext/reflection/tests/ReflectionClassConstant_toString.phpt
Daniel Scherzer 0da9d196b1 Reflection: print boolean constant values as true and false
Updates the output of `ReflectionClassConstant::__toString()` and
`ReflectionConstant::__toString()`, as well as the other ways that class
constants are printed, e.g. `ReflectionClass::__toString()`.
2026-09-22 13:24:10 -07:00

40 lines
710 B
PHP

--TEST--
ReflectionClassConstant::__toString() and class constant display
--FILE--
<?php
class Demo {
public const IS_TRUE = true;
public const IS_FALSE = false;
}
echo new ReflectionClassConstant(Demo::class, 'IS_TRUE');
echo new ReflectionClassConstant(Demo::class, 'IS_FALSE');
echo new ReflectionClass(Demo::class);
?>
--EXPECTF--
Constant [ public bool IS_TRUE ] { true }
Constant [ public bool IS_FALSE ] { false }
Class [ <user> class Demo ] {
@@ %s %d-%d
- Constants [2] {
Constant [ public bool IS_TRUE ] { true }
Constant [ public bool IS_FALSE ] { false }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}