Skip to content

Resolve Mixed and Never as classes outside type positions - #41

Merged
TomasVotruba merged 1 commit into
mainfrom
builtin-types-type-position
Nov 27, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
builtin-types-type-position

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #40. The new built-ins (null, false, true, mixed, never) now apply only in type positions (ResolveType). In class positions - new, extends, instanceof, catch - PHP 7 code may declare a class named Mixed or Never, so extends Mixed resolves to App\Mixed again, not mixed. This matches nikic/PHP-Parser.

Found when bumping reco: a test with class MixedChild extends Mixed started resolving the parent to mixed.

null, false, true, mixed and never are built-in only where a type is
expected. In class positions (new, extends, instanceof, catch) PHP 7 code may
declare a class named Mixed or Never, so those keep resolving against the
namespace, as nikic/PHP-Parser does.
@TomasVotruba
TomasVotruba merged commit 1c87779 into main Nov 27, 2026
5 checks passed
@TomasVotruba
TomasVotruba deleted the builtin-types-type-position branch November 27, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant