Re: Make Reflection*::getDocComment() return an empty string instead of false
| From: | Alexandru Pătrănescu | Date: | Wed, 25 Jun 2025 14:19:23 +0000 |
| Subject: | Re: Make Reflection*::getDocComment() return an empty string instead of false | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127755@lists.php.net to get a copy of this message | ||
On Wed, Jun 25, 2025 at 4:22 PM Kamil Tekiela <tekiela246@gmail.com> wrote:
> What exactly is the context in which symfony uses it?
>
Was wondering just that, and I can only imagine it's a function call that
receives the parameter as a string and it would getDocComment() result is
passed directly, sometimes being false.
Example:
https://github.com/symfony/symfony/blob/a3c1d1f9e9bbac9933cc3792a55e756eca5bb495/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1177
I think that for those cases
getDocComment() :? '' might be a faster fix
and move on with it.
And symfony already does this in some places:
https://github.com/symfony/symfony/blob/a3c1d1f9e9bbac9933cc3792a55e756eca5bb495/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php#L53
IMHO, it's not worth the compatibility breakage, as some others might
already compare it using === false.
--
Alex