Skip to content

Checker: whole-program type checking for PHP# in the Mago fork #2

Open

Description

@heyJordanParker

The engine compiles one file at a time by design: opcache sets ZEND_COMPILE_IGNORE_OTHER_FILES. So a type error that spans files is only known before the code runs if a whole-program checker finds it. That checker is PHP#'s compiler, as Roslyn is for C# and hh_client is for Hack.

Capability: the consumer's Mago fork (github.com/heyJordanParker/mago) parses PHP# natively and fails check on any type error. That covers generics, list<T> and map<K, V>, internal, delegates and closed unions, with no ignore list. Its language server, from upstream PR php#1926, gives Agents and editors the same diagnostics.

Starting point: upstream Mago branch rfc/generic-types (PR php#1826, +1,450 lines) already parses <T> and ::<T>. Its analyzer and codex crates do not understand native generics yet.

Why later: each syntax decision in this repo becomes checker work once the engine side lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions