Skip to content

Implement declare(strict_namespace=1) to disable global name fallback#22736

Open
pmjones wants to merge 1 commit into
php:masterfrom
pmjones:strict-namespace
Open

Implement declare(strict_namespace=1) to disable global name fallback#22736
pmjones wants to merge 1 commit into
php:masterfrom
pmjones:strict-namespace

Conversation

@pmjones

@pmjones pmjones commented Jul 15, 2026

Copy link
Copy Markdown

This introduces a file-scoped declare that disables the global fallback on function and constant names. Unqualified functions and constants in a namespace resolve to the current namespace only when strict_namespace=1. The special constants true/false/null still resolve correctly.

This is a compile-time change only; no VM, JIT, or runtime changes.

RFC forthcoming.

This introduces a file-scoped `declare` that disables the global fallback on
function and constant names. Unqualified functions and constants in a
namespace resolve to the current namespace only when `strict_namespace=1`.
The special constants `true`/`false`/`null` still resolve correctly.

This is a compile-time change only; no VM, JIT, or runtime changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants