Skip to content

fix(config): the schema allows naming the class or property of MissingDependency and four other issues - #14649

Merged
orklah merged 5 commits into
vimeo:masterfrom
jirkace:fix/4929-schema-issue-handler-types
Nov 23, 2026
Merged

orklah merged 5 commits into
vimeo:masterfrom
jirkace:fix/4929-schema-issue-handler-types

Conversation

@jirkace

@jirkace jirkace commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

<referencedClass> can't be used in the issue handler of MissingDependency (and of ClassMustBeFinal, ReservedWord, UnusedBaselineEntry; <referencedProperty> of InvalidPropertyAssignmentValue): the config schema rejects it, although Psalm narrows these issues to the class or property named.

Before

<issueHandlers>
    <MissingDependency>
        <errorLevel type="suppress">
            <referencedClass name="Bc\Layer" /> <!-- ConfigException: Error on line 9 (schema) -->
        </errorLevel>
    </MissingDependency>
</issueHandlers>

After

            <referencedClass name="Bc\Layer" /> <!-- MissingDependency of Bc\Layer suppressed -->

Fixes #4929

…gDependency and four other issues vimeo#4929

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

jirkace commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Behaviour change

  • config.xsd now gives these issue handlers the type that matches their issue class, so the element naming what the issue is about is accepted: MissingDependency, ClassMustBeFinal, ReservedWord, UnusedBaselineEntry (ClassIssueHandlerType: <referencedClass>) and InvalidPropertyAssignmentValue (PropertyIssueHandlerType: <referencedProperty>). Before, a config using them failed schema validation. Config::getReportingLevelFor*() already handled them; no PHP code changes.
  • New test testTheSchemaAllowsNamingWhatAnIssueIsAbout checks every issue handler of the schema whose issue class is a ClassIssue, MethodIssue, FunctionIssue, PropertyIssue, ArgumentIssue, VariableIssue or ClassConstantIssue.
  • Not changed: the reverse mismatch, where the schema accepts an element the config then ignores because the issue class is a plain CodeIssue (e.g. referencedMethod for DuplicateMethod / InaccessibleMethod, referencedProperty for NullPropertyFetch / NullPropertyAssignment / OverriddenPropertyAccess, referencedFunction for InvalidTemplateParam / TooManyTemplateParams / UnusedPsalmSuppress, ArgumentIssueHandlerType for MixedClone, ClassIssueHandlerType for InheritorViolation). Fixing that means changing those issue classes (plugin API) or making existing configs invalid, so it is left out.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Performance: unchanged · Types: unchanged

Project Memory (MB) Wall (s) Issues Weighted (types) Taint Dead code
✅ laravel 1 772 100.7 $\color{gray}{\textsf{+0.8\%}}$ 25 792 53 100 743 0
✅ symfony 3 619 187.8 $\color{gray}{\textsf{-3.6\%}}$ 51 767 100 629 1 582 0
✅ doctrine-orm 381 21.0 $\color{gray}{\textsf{+1.3\%}}$ 3 459 6 218 0 0
✅ psl 618 24.1 1 387 5 600 1 0
✅ phpunit 456 20.3 $\color{gray}{\textsf{-0.1\%}}$ 1 735 3 418 18 0
✅ php-parser 226 13.8 17 116 21 187 0 0
✅ tempest 898 37.2 $\color{gray}{\textsf{-0.9\%}}$ 5 094 10 556 275 0
✅ amphp-amp 48 1.3 $\color{gray}{\textsf{-1.5\%}}$ 29 49 0 0
✅ webmozarts-assert 273 3.7 $\color{gray}{\textsf{+0.8\%}}$ 575 2 714 0 0
✅ guzzle-promises 46 1.4 $\color{gray}{\textsf{-2.1\%}}$ 155 433 2 0
✅ monolog 136 4.5 $\color{gray}{\textsf{-1.7\%}}$ 918 2 491 11 0
✅ drupal 4 847 193.2 $\color{gray}{\textsf{+0.2\%}}$ 97 949 169 915 575 0
✅ wordpress 2 061 139.7 $\color{gray}{\textsf{-1.6\%}}$ 143 633 678 503 505 1
Total 15 381 748.7 $\color{gray}{\textsf{-1.1\%}}$ 349 609 1 054 813 3 712 1
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 +10 % 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. Its wall time warns above +5 % (±5 % is noise); the other thresholds apply per project.
  • 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.

head 254a137 · base b5ea40d (merge-base) · workflow run

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

@orklah orklah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Aligning the schema with the issue classes and locking it with a test is the right direction. Two things before this can go in:

  1. MissingDependency still can't be suppressed the way #4929 asks. The issue's ClassIssue subject is the class that depends on the missing one ($fq_class_name in ClassLikeAnalyzer::checkFullyQualifiedClassLikeName()), not the missing dependency. With this branch:

    class Layer extends Not\Currently\Installed {}
    function f(): void { new Layer(); }
    <MissingDependency>
        <errorLevel type="suppress">
            <referencedClass name="Not\Currently\Installed" />
        </errorLevel>
    </MissingDependency>

    still reports MissingDependency: Layer depends on class or interface not\currently\installed that does not exist, plus UnusedIssueHandlerSuppression. Only <referencedClass name="Layer" /> works, which doesn't help a BC layer where many classes depend on the same absent class. Since the schema rejected <referencedClass> here until now, no existing config relies on the subject, so passing $dependency_class_name as the issue's class would make the issue's config work. Please add a test that analyses a file like the one above and asserts the issue is suppressed by the dependency's name (the current test only calls getReportingLevelForClass() with a name it picks itself).

  2. UnusedBaselineEntry can't use <referencedClass>. It's never instantiated: IssueBuffer::finish() builds its IssueData directly, with no class and without going through Config::getReportingLevelFor*(), so the filter would be accepted and never apply. Please keep it as IssueHandlerType and exclude it explicitly in testTheSchemaAllowsNamingWhatAnIssueIsAbout.

The red CI jobs (Config.php:1360, DocumentationTest::testShortcodesAreUnique, the code style warnings) come from master at the time of the run, not from this PR; the next push will re-run them.

jirkace and others added 3 commits November 23, 2026 14:41
…dBaselineEntry takes no class filter vimeo#4929

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 23, 2026

@orklah orklah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jirkace!

@orklah
orklah merged commit 1301808 into vimeo:master Nov 23, 2026
71 of 72 checks passed
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.

Feature: Suppress MissingDependency by dependency

2 participants