On Wed, Jun 25, 2025, at 5:37 AM, Gina P. Banyard wrote: > Hello internals, > > While working on the deprecation to/from bool type juggling in > functions RFC and seeing the impact within Symfony, we found a common > slightly annoying case. > The getDocComment method of various Reflection classes was always used > as a string, and we thought changing the behaviour in PHP made more > sense. > > I submitted a PR [1] but was asked to gather feedback on the mailing list. > > Please let me know what you think. > > Best regards, > > Gina P. Banyard > > [1] https://github.com/php/php-src/pull/18928
The use of false as a sentinel value is always wrong[1], so I agree with the issue. Whether the BC break is worth it is a harder question. Whether it changes to null or empty string, I think, depends on whether in context empty string is a reasonable "zero value." Viz, will it fail gracefully automatically, the way an empty array would for "get list of things"? If so, empty string is probably better. If not, null is reasonable given the current state of the language. Null is arguably more purely correct, but empty string may be more ergonomic in practice. I defer to Nicolas who has probably had to deal with it more than I ever will. :-) [1] https://www.garfieldtech.com/blog/empty-return-values --Larry Garfield