Skip to content

views: the View interface still requires stdClass after templates lost dynamic properties #175

Open

Description

@schlessera

Context

At main 15cac4c2, src/Infrastructure/View.php:32 still declares @phpstan-require-extends stdClass; src/Infrastructure/View/SimpleView.php:35-39 and src/Infrastructure/View/EmptyView.php:29-31 retain the inheritance and its old dynamic-property explanation. Templates now run in a separate scope (SimpleView.php:193-249), following #156/#174, and receive presenters per render (#173/#176).

phpstan.neon.dist:11-13 lists View and TemplateScope as universal object crates. That analyser configuration describes magic property access; it does not itself preserve runtime inheritance or permission to create dynamic properties on the view. Removing the requirement and removing the built-in inheritance are separate compatibility choices. Generated plugins may subclass SimpleView, check instanceof stdClass, or write properties outside templates.

Out of scope

Changing template isolation, presenter contracts, escaping or the debug/production rendering policy; implementing a removal before its compatibility ruling; raising the PHP floor.

Scope and next deliverable

Prepare a design proposal as a comment, comparing retaining the contract with correcting its explanation, removing the analyser requirement while retaining built-in inheritance, and removing both. Assess custom View implementations, SimpleView subclasses, instanceof checks and external dynamic-property writes. Recommend the smallest justified change and state migration costs. No proposal or removal is approved yet.

Acceptance criteria

  • Verify where the scaffold and its tests still depend on stdClass, distinguishing static analysis from runtime behaviour.
  • Post options, trade-offs, fit with the design principles and a recommendation, including the compatibility consequences for custom views/subclasses and PHP 7.4/8.2+.
  • Give a verification plan preserving property reads, templates, presenters, partials, escaping and both debug modes; assess the API snapshot and analyser configuration.
  • Identify the exact inherited-contract changes needing a maintainer ruling. After the proposal, add needs: decision and remove agent-ready; implementation waits for that ruling.

Verification

Review the cited declarations, tests/php/Unit/SimpleViewTest.php, SimpleViewPresenterTest.php, view-factory tests, and tests/php/Architecture/infrastructure-api.txt. The proposal includes eventual composer test and composer lint validation on the supported environments. This pass changes no PHP code.

Impact on generated plugins

Potentially breaking inherited/runtime and analyser contracts; keep breaking pending a concrete ruling. Priority p2: ordinary unscheduled cleanup of a now-obsolete template rationale. agent-ready authorizes proposal work only.

Updated 2026-10-24: Completed the stdClass investigation brief, corrected moved anchors and distinguished analyser crates from runtime inheritance. Added p2 and agent-ready for a proposal only; breaking stays and implementation needs a subsequent ruling. Reviewed origin/main 15cac4c2.

Activity

  1. added
    type: refactorStructure changes; behaviour does not.
    area: infrastructuresrc/Infrastructure: services, injector, views, autoloader. What generated plugins build on.
    breakingChanges an interface or convention generated plugins rely on. Needs a ruling before code.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 23, 2026
  2. schlessera commented on Oct 24, 2026

    @schlessera
    MemberAuthor

    Triage (2026-10-24): Completed the stdClass investigation brief, corrected moved anchors and distinguished analyser crates from runtime inheritance. Added p2 and agent-ready for a proposal only; breaking stays and implementation needs a subsequent ruling.

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

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: infrastructuresrc/Infrastructure: services, injector, views, autoloader. What generated plugins build on.breakingChanges an interface or convention generated plugins rely on. Needs a ruling before code.priority: p2Wanted, not scheduled.type: refactorStructure changes; behaviour does not.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions