Skip to content

PHP: typed locals and typed params resolve, with scope poisoning #4

Closed

Description

@filipechagas

Parent

Spec: #1 (upstream: Graphify-Labs#1682)

What to build

Calls through typed locals ($svc = new Service(); $svc->method()) and natively typed method parameters (function handle(Service $svc)) get INFERRED calls edges. A per-method receiver layer feeds the resolver, and any name whose binding is not provably single-typed is poisoned so no edge is emitted: non-new reassignment, conflicting new types, closure and arrow-function parameters that shadow the name, foreach targets, list-destructuring elements. Anonymous-class subtrees are skipped when scanning method bodies.

Acceptance criteria

  • $svc = new Service(); $svc->method() yields an INFERRED edge; decoy gets no edge
  • Typed method parameter receiver yields an INFERRED edge
  • $svc = new A(); $svc = $other; $svc->m() yields no edge
  • $svc = new A(); $svc = new B(); $svc->m() yields no edge to either class
  • A closure/arrow-fn parameter shadowing an outer typed name: the call inside the closure yields no edge from the outer type
  • A foreach target shadowing an outer typed name yields no edge from the outer type
  • A new inside an anonymous class body does not bind names in the enclosing method
  • Chained receivers ($a->b()->c()) yield no edge

Blocked by

Activity

  1. added
    ready-for-agent
    on Aug 5, 2026
  2. filipechagas commented on Aug 5, 2026

    @filipechagas
    CollaboratorAuthor

    Implemented in a707b42. Orchestrator gate: full suite 3975/36 (+18 tests). Typed params and $var-new locals resolve INFERRED; poisoning covers non-new reassignment, conflicting new, augmented assignment, closure AND arrow-fn param shadowing (unconditional poison — stricter than the design snippet, per AC), foreach targets, list destructuring; anonymous-class subtrees skipped; chained receivers inert. Flagged for #7: qualified inline-new is EXTRACTED but qualified local-new stays INFERRED (each per its ticket AC) — to be named in changelog/PR.

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

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions