Skip to content

feat: add support for native generic types#1826

Draft
azjezz wants to merge 7 commits into
mainfrom
rfc/generic-types
Draft

feat: add support for native generic types#1826
azjezz wants to merge 7 commits into
mainfrom
rfc/generic-types

Conversation

@azjezz
Copy link
Copy Markdown
Member

@azjezz azjezz commented May 13, 2026

Not a final implementation, just trying it out here. We would need many tests ( currently this PR has none ), initial goal is to first thread the new syntax through all tools ( formatter, linter, semantics checker, analyzer, …), then verify correctness against php-src tests ( the compile-time/link-time errors ).

Codex is going to be the tricky one, this PR treats the new generics the same as the ones that are in the docblocks, but, that's wrong. the new PHP syntax allows for class A implements Foo<string>, Foo<int> {} which is not something possible currently using docblocks ( i.e implementing the same interface twice ) - at least not in Mago.

  • php-version
  • syntax
  • semantics
  • formatter
  • linter
  • fingerprint
  • codex
  • analyzer

ref php/php-src#21969

azjezz added 7 commits May 13, 2026 01:33
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Signed-off-by: azjezz <azjezz@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant