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

[email protected] (Tim Düsterhus) Thu, 16 Jul 2026 14:53:11 +0200
Newsgroups php.internals
Message-ID <[email protected]>
Hi

On 2026-07-15 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

Thank you for the RFC. I'm, probably unsurprisingly, in favor.

However I agree with Rowan that the naming of the directive could be 
made clearer. I could imagine `declare(global_fallback=0)` (with 1 being 
the default) being a reasonable option between clarity and brevity.

With regard to the “RFC Impact” section, the “None” for the ecosystem is 
not quite accurate: Static analyzers and IDEs will want to learn about 
the directive to

1. Emit diagnostics when a function or constant is not explicitly 
imported and doesn't exist in the namespace.
2. Emit diagnostics when the directive is not used despite being 
configured as “desirable” to make sure it is consistently applied within 
an entire project.

This kind of “work being imposed because otherwise the tools would be 
worse than they could be” on downstream projects is the main goal of the 
“Ecosystem Impact” section, obvious compatibility breaks are already 
listed in the “Backward Incompatible Changes” section :-)

Best regards
Tim Düsterhus