On 25 June 2025 11:37:37 BST, "Gina P. Banyard" <intern...@gpb.moe> wrote:
>The getDocComment method of various Reflection classes was always used as a
>string, and we thought changing the behaviour in PHP made more sense.
Looking at the stub file, the use of false instead of null to signal "no value"
seems to be used in a bunch of places in that extension. For instance,
getExtensionName() apparently returns false to indicate a user-defined
function, while getFileName() returns false for the opposite case.
Returning an empty string when there's actually no comment feels a bit awkward
and inconsistent - for example, we don't return a "no type" object from
getReturnType().
I think returning null rather than false for all of these would be preferable.
From a compatibility point of view, it's not much different from changing to
return '' or 0 for those cases, but feels more logical as a design.
Rowan Tommins
[IMSoP]