Skip to content

feat: resolve the object pseudo-type and Closure type-hint#467

Open
chadmandoo wants to merge 2 commits into
illegalstudio:mainfrom
chadmandoo:upstream-pr/pseudo-type-resolution
Open

feat: resolve the object pseudo-type and Closure type-hint#467
chadmandoo wants to merge 2 commits into
illegalstudio:mainfrom
chadmandoo:upstream-pr/pseudo-type-resolution

Conversation

@chadmandoo

Copy link
Copy Markdown
Contributor

Two name-resolution completeness fixes for type positions: the object built-in pseudo-type resolved as a namespaced class name ("Unknown type: App\object"), and the Closure type-hint was unrecognized in param/return/property positions. object maps to the top object type; Closure maps to the callable representation but stays permitted as a PROPERTY type (PHP allows a Closure-typed property while forbidding bare callable there). Byte-parity vs PHP 8.5 + regression test.

chadmandoo added a commit to chadmandoo/elephc that referenced this pull request Jul 10, 2026
…4/#593, illegalstudio#467)

v0.26.1 rejected `Closure` and `object` type-hints as "Unknown type". Re-ports
the illegalstudio#467 resolution (88% → 90%, 269 → 277/307):

- `object` pseudo-type resolves to Mixed (elephc has no classless-object variant;
  Mixed boxes any value, objects included). name_resolver keeps it unprefixed;
  pointers.rs resolves it.
- `Closure` class-name type-hint resolves to Callable (closures resolve to
  Callable internally) for params, returns, AND properties. PHP forbids the bare
  `callable` pseudo-type as a property type but PERMITS the `Closure` spelling, so
  resolve_declared_property_type_hint lets `Closure` through the callable
  restriction via type_expr_names_closure (a bare `callable` property still
  rejected).

Clears the `Unknown type: Closure` + `Unknown type: <FQCN>` (object) family (8).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chadmandoo
chadmandoo force-pushed the upstream-pr/pseudo-type-resolution branch from fa272ce to c117052 Compare July 11, 2026 13:56
@github-actions github-actions Bot added area:resolver Touches include, namespace, name, or autoload resolution. area:types Touches type checking, inference, or compatibility. size:s Small pull request. type:feature Introduces new user-visible behavior or capabilities. labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:resolver Touches include, namespace, name, or autoload resolution. area:types Touches type checking, inference, or compatibility. size:s Small pull request. type:feature Introduces new user-visible behavior or capabilities.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant