Re: [PHP-DEV] [RFC] Strict Namespace Resolution

[email protected] (Ilija Tovilo) Wed, 15 Jul 2026 19:57:23 +0200
Newsgroups php.internals
Message-ID <[email protected]>
Hi Paul

On 15.07.26 19:48, Paul M. Jones wrote:
> Hi Ilia,
I normally don't correct people on my name, but just to avoid confusion: 
We now have myself and Ilia Alshanetsky being active again. Just want to 
point out that we're two different people.
>> On Jul 15, 2026, at 10:54, Ilija Tovilo<[email protected]> 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?

I understand, but the value-add of this declaration is very small if the 
plan isn't ever to deprecate/remove the old behavior.

  * People who opt-in don't gain anything new. They were already relying
    on the exact same behavior, with the fallback never triggering.
  * It might help with conformance, but not beyond what a linter could
    already do automatically.
  * The people who don't opt-in won't overcome the optimization limitations.
  * The ecosystem remains fragmented.