Reflection(Class)Constant::__toString() should print booleans as booleans
未关闭
@DanielEScherzer 已经在做这个了。
开始于 2026年7月10日。
Extension: reflection
Feature
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
<?php
echo new ReflectionConstant('true');
echo new ReflectionConstant('false');
class Demo {
public const MY_TRUE = true;
public const MY_FALSE = false;
public $true = true;
public $false = false;
}
echo new ReflectionClassConstant(Demo::class, 'MY_TRUE');
echo new ReflectionClassConstant(Demo::class, 'MY_FALSE');
echo new ReflectionProperty(Demo::class, 'true');
echo new ReflectionProperty(Demo::class, 'false');
function demo($t = true, $f = false) {}
echo new ReflectionFunction('demo');
shows:
Constant [ <persistent> bool TRUE ] { 1 }
Constant [ <persistent> bool FALSE ] { }
Constant [ public bool MY_TRUE ] { 1 }
Constant [ public bool MY_FALSE ] { }
Property [ public $true = true ]
Property [ public $false = false ]
Function [ <user> function demo ] {
@@ /in/5nqGe 18 - 18
- Parameters [2] {
Parameter #0 [ <optional> $t = true ]
Parameter #1 [ <optional> $f = false ]
}
}
booleans in constants should be true or false, not 1 or (missing)
Marking as a feature request since this is a behavior change and shouldn't be applied to released versions
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。