Re: [RFC] Strict Namespace Resolution
| From: | Paul M. Jones | Date: | Wed, 15 Jul 2026 17:48:40 +0000 |
| Subject: | Re: [RFC] Strict Namespace Resolution | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131942@lists.php.net to get a copy of this message | ||
Hi Ilia,
> On Jul 15, 2026, at 10:54, Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> Hi Paul
> On 15.07.26 02:54, Paul M. Jones wrote:
>> Per feedback from Tim Tim Düsterhus
>> <https://externals.io/message/131332#131899> I have extracted
>> the
declare(strict_namespace=1) portion of the function autoloading
>> proposal to its own RFC.
>>
>> - RFC: https://wiki.php.net/rfc/strict-namespace
>> - PR: https://github.com/php/php-src/pull/22736
>>
>> (This RFC is an aid to, but not strictly required for, function autoloading.)
> This flag forces the use of a \ prefix, but it's worth noting there are some communities
> (e.g. Laravel and Symfony) who have explicitly rejected the idea of prefixing all functions for
> readability reasons. We can force them into conforming, or forever keep the old behavior, but
> that's probably not the best approach.
I sympathize with that rejection -- I don't especially like prefixing everything with \ myself.
Even having to import every global function explicitly, as required under some coding stndards
rulesets, feels noisy to me at times.
But to be clear, declare(strict_namespace=1) is an opt-in behavior. If you want the
global fallback behavior, no need to declare the directive. Further, I would not advise
"forcing" anyone to use it who doesn't want it.
Have I maybe missed what you were getting at?
-- pmj