Skip to content

Fix template arguments of a parent named in another case, share @extends/@implements/@use scanning - #14397

Merged
orklah merged 2 commits into
vimeo:masterfrom
orklah:templated-type-tags
Nov 20, 2026
Merged

orklah merged 2 commits into
vimeo:masterfrom
orklah:templated-type-tags

Conversation

@orklah

@orklah orklah commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Parent named in another case

@extends loses its type arguments when the extends clause or the tag names the parent in another case.

Before

<?php
/** @template T */
class Foo {}

/** @extends Foo<int> */
final class Bar extends foo {} // MissingTemplateParam, InvalidClass

/** @template T */
interface I {}

/** @extends I<int> */
interface J extends i {} // MissingTemplateParam, InvalidClass

After

final class Bar extends foo {} // InvalidClass
interface J extends i {} // InvalidClass

Before

<?php
/** @template T */
class Foo {
    /** @var T|null */
    public $t = null;
}

/** @extends foo<int> */
final class Bar extends Foo {} // MissingTemplateParam

$a = (new Bar)->t; // mixed

After

final class Bar extends Foo {} // no issue

$a = (new Bar)->t; // int|null

The same holds for @implements i<int> and @use tr<int>, whose type arguments were dropped.

Union in @implements / @use

A union in @implements or @use also reports every parent it names as missing its template params; @extends already read the union member by member.

Before

<?php
/** @template T */
interface I {}

/** @template T */
interface J {}

/** @implements I<int>|J<int> */ // InvalidDocblock
final class C implements I, J {} // MissingTemplateParam (twice)

After

final class C implements I, J {} // no issue

Message of an empty @implements / @use

Before

<?php
/** @template T */
interface I {}

/** @implements */ // InvalidDocblock: Extended class cannot be empty in docblock for C
final class C implements I {}

After

/** @implements */ // InvalidDocblock: Implemented class cannot be empty in docblock for C

…lowercase name

@extends stored its parameter count under the name as written in the
docblock, while readers looked it up under the name of the extends clause,
so a parent named in another case reported MissingTemplateParam. The type
arguments of all three tags were also keyed by the written name, and lost
when the docblock used another case than the class.

A union in @implements or @use is now read member by member, as @extends
already did, and the empty-tag messages name the right kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 20, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-20T20:29:57.033755Z
We couldn’t complete this review. Comment @codex review to try again.
dc5ed0f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Performance: unchanged · Types: unchanged

Project Memory (MB) Wall (s) Issues Weighted (types) Taint
✅ laravel 1 766 93.7 $\color{gray}{\textsf{+0.1\%}}$ 25 925 53 512 677
✅ symfony 3 605 255.2 $\color{gray}{\textsf{-0.1\%}}$ 50 580 98 373 1 491
✅ doctrine-orm 393 21.7 $\color{gray}{\textsf{+0.9\%}}$ 3 480 6 161 0
✅ psl 632 27.7 $\color{gray}{\textsf{+1.3\%}}$ 1 299 5 455 1
✅ phpunit 471 20.2 $\color{gray}{\textsf{+0.8\%}}$ 1 744 3 459 18
✅ php-parser 236 13.8 $\color{gray}{\textsf{-0.7\%}}$ 17 133 21 035 0
✅ tempest 903 36.3 $\color{gray}{\textsf{+0.9\%}}$ 5 039 10 507 242
✅ amphp-amp 61 1.8 $\color{gray}{\textsf{-1.1\%}}$ 29 49 0
✅ webmozarts-assert 287 4.2 $\color{gray}{\textsf{-0.5\%}}$ 578 2 724 0
✅ guzzle-promises 56 1.9 $\color{gray}{\textsf{+1.6\%}}$ 154 427 2
✅ monolog 153 5.2 $\color{gray}{\textsf{-6.7\%}}$ 903 2 403 10
✅ drupal 4 850 151.0 $\color{gray}{\textsf{+2.1\%}}$ 97 524 169 104 568
Total 13 413 632.6 $\color{gray}{\textsf{+0.5\%}}$ 204 388 373 209 3 009
How to read this table
  • Memory: Psalm's own peak figure, threads=1. More than +5 % fails, unless the PR changes composer.json.
  • Wall: base and head run on the same runner; ±10 % is noise. Above +20 % warns, never fails. re-run: a reversed second run was taken and the faster kept.
  • Issues: head count over all categories, then $\color{red}{\textsf{+added}}$ $\color{green}{\textsf{-removed}}$ against base.
  • Weighted (types): type issues weighted by error level (levels 1–8 as is, always-errors 10, strictness checks 1). Taint and dead-code issues are not weighed. The projects' own code is pinned and their dependencies resolve identically for base and head, so a change means Psalm reports more, fewer or differently serious issues. A rise is not necessarily a regression.
  • Taint: head count of Tainted* issues, then $\color{orange}{\textsf{+added}}$ $\color{orange}{\textsf{-removed}}$ against base. Both are orange as either direction needs review: more can be new detection or false positives, fewer can be fixed false positives or lost detection.
  • Dead code: head count of unused-code issues, shown only when a run reported some (findUnusedCode). More is red, fewer is green.
  • Total: sum over the projects compared on both sides. Thresholds apply per project, not to the total.
  • Colors: $\color{red}{\textsf{red}}$ past a fail or warn threshold (or more issues), $\color{green}{\textsf{green}}$ an improvement past noise (or fewer issues), $\color{orange}{\textsf{orange}}$ needs review, $\color{gray}{\textsf{gray}}$ noise.
  • Performance: regressed if a head run crashed or timed out or a memory or wall delta is red, else improved if one is green, else unchanged. Its icon is the check result: ❌ fail · ⚠️ warn · ✅ pass; the icon next to each project is that project's result, 💥 = not comparable: base crashed or timed out (counts as ⚠️).
  • Types (heading): direction of the total weighted change, increased · decreased · unchanged. Taint and Dead code (heading): added and removed counts, present only when non-zero. Informational, never fails the check.

composer.json changed in this PR, so head dependencies were re-resolved; memory and time deltas are informational.

head aacd867 · base cc4ab02 (merge-base) · workflow run

orklah added a commit to psalm/psalm-plugin-laravel that referenced this pull request Nov 20, 2026
… name too (#2372)

* fix: read and write template argument keys under the lowercase parent name too

Psalm keys template_type_extends_count and template_extended_offsets by the
lowercase parent name since vimeo/psalm#14397, by the name as written before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: mark explicitExtendsCount read-props

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…te argument keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@orklah
orklah merged commit 419de43 into vimeo:master Nov 20, 2026
70 checks passed
@orklah
orklah deleted the templated-type-tags branch November 20, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant