Re: [RFC] Strict Namespace Resolution
| From: | Ilija Tovilo | Date: | Wed, 15 Jul 2026 17:57:23 +0000 |
| Subject: | Re: [RFC] Strict Namespace Resolution | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131943@lists.php.net to get a copy of this message | ||
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.
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.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: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,Per feedback from Tim Tim Düsterhus<https://externals.io/message/131332#131899> I have extracted theThis 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.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.)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?