Skip to content

Don't report MethodSignatureMismatch for @no-named-arguments on parameterless methods - #14799

Merged
orklah merged 1 commit into
vimeo:masterfrom
orklah:no-named-args-parameterless
Nov 24, 2026
Merged

orklah merged 1 commit into
vimeo:masterfrom
orklah:no-named-args-parameterless

Conversation

@orklah

@orklah orklah commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Psalm reports a false MethodSignatureMismatch on parameterless methods of a class tagged @no-named-arguments.

Before

<?php
/**
 * @no-named-arguments
 * @implements IteratorAggregate<int, int>
 */
final class C implements Countable, IteratorAggregate {
    public function count(): int { // MethodSignatureMismatch: Method C::count should accept named arguments as Countable::count does
        return 0;
    }

    public function getIterator(): Iterator { // MethodSignatureMismatch
        return new ArrayIterator([]);
    }
}

After

    public function count(): int { // no issue
    public function getIterator(): Iterator { // no issue

Fixes #14763

🤖 Generated with Claude Code

… method

A method without parameters can't be passed named arguments, so a
@no-named-arguments override of it (directly or from its class tag)
breaks nothing.

Fixes vimeo#14763

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 24, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T08:42:22.964085Z b6726f5 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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Performance: unchanged · Types: decreased

Project Memory (MB) Wall (s) Issues Weighted (types) Taint Dead code
✅ laravel 1 747 99.6 $\color{gray}{\textsf{-0.1\%}}$ 25 790 53 070 743 0
✅ symfony 3 619 295.6 $\color{gray}{\textsf{+2.0\%}}$ 51 739 100 455 1 582 0
✅ doctrine-orm 381 19.2 $\color{gray}{\textsf{+0.1\%}}$ 3 453 6 194 0 0
✅ psl 618 22.4 1 387 5 600 1 0
✅ phpunit 427 15.3 $\color{gray}{\textsf{+1.3\%}}$ 1 590 $\color{red}{\textsf{+4}}$ $\color{green}{\textsf{-149}}$ 2 403 $\color{green}{\textsf{-1 015}}$ 18 0
✅ php-parser 226 9.6 $\color{gray}{\textsf{-0.2\%}}$ 17 113 21 177 0 0
✅ tempest 887 27.4 $\color{gray}{\textsf{+1.1\%}}$ 5 092 10 537 275 0
✅ amphp-amp 48 1.6 29 49 0 0
✅ webmozarts-assert 274 4.8 $\color{gray}{\textsf{+0.6\%}}$ 575 2 714 0 0
✅ guzzle-promises 46 1.7 155 433 2 0
✅ monolog 134 5.9 $\color{gray}{\textsf{-0.7\%}}$ 918 2 491 11 0
✅ drupal 4 767 248.0 $\color{gray}{\textsf{+0.8\%}}$ 97 838 169 303 575 0
✅ wordpress 2 012 203.0 $\color{gray}{\textsf{+0.2\%}}$ 143 499 678 345 505 1
Total 15 185 954.0 $\color{gray}{\textsf{+0.9\%}}$ 349 178 $\color{red}{\textsf{+4}}$ $\color{green}{\textsf{-149}}$ 1 052 771 $\color{green}{\textsf{-1 015}}$ 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.
✅ phpunit: issues +4 −149

Memory 427 → 427 MB (<0.1 %) · Wall 15.1 → 15.3 s (+1.3 %)

Weighted 3 418 → 2 403 (−1 015, −29.70 %): L7 −145

Issue type added removed
MethodSignatureMismatch 4 149

Changed in place (4); {self} is the class named after the file

@​@​ 4 places MethodSignatureMismatch @​@​
  src/Framework/MockObject/Runtime/InvocationMockerImplementation.php:30
  src/Framework/MockObject/Runtime/InvocationMockerImplementation.php:41
  src/Framework/MockObject/Runtime/InvocationMockerImplementation.php:52
  src/Framework/MockObject/Runtime/InvocationMockerImplementation.php:63
- Method {self}::with should accept named arguments as InvocationMocker::with does
+ Method {self}::with should accept named arguments as InvocationMocker::with does

Removed (145)

  • src/Event/Events/EventCollection.php:43 MethodSignatureMismatch (error): Method EventCollection::count should accept named arguments as Countable::count does
  • src/Event/Events/EventCollection.php:58 MethodSignatureMismatch (error): Method EventCollection::getiterator should accept named arguments as IteratorAggregate::getiterator does
  • src/Event/Events/EventCollectionIterator.php:40 MethodSignatureMismatch (error): Method EventCollectionIterator::rewind should accept named arguments as Iterator::rewind does
  • src/Event/Events/EventCollectionIterator.php:45 MethodSignatureMismatch (error): Method EventCollectionIterator::valid should accept named arguments as Iterator::valid does
  • src/Event/Events/EventCollectionIterator.php:53 MethodSignatureMismatch (error): Method EventCollectionIterator::key should accept named arguments as Iterator::key does
  • src/Event/Events/EventCollectionIterator.php:58 MethodSignatureMismatch (error): Method EventCollectionIterator::current should accept named arguments as Iterator::current does
  • src/Event/Events/EventCollectionIterator.php:65 MethodSignatureMismatch (error): Method EventCollectionIterator::next should accept named arguments as Iterator::next does
  • src/Event/Value/Test/TestCollection.php:51 MethodSignatureMismatch (error): Method TestCollection::count should accept named arguments as Countable::count does
  • src/Event/Value/Test/TestCollection.php:56 MethodSignatureMismatch (error): Method TestCollection::getiterator should accept named arguments as IteratorAggregate::getiterator does
  • src/Event/Value/Test/TestCollectionIterator.php:40 MethodSignatureMismatch (error): Method TestCollectionIterator::rewind should accept named arguments as Iterator::rewind does
  • … and 135 more

head b6726f5 · base e3b3676 (merge-base) · workflow run

@orklah
orklah merged commit 9ab0b80 into vimeo:master Nov 24, 2026
75 checks passed
@orklah
orklah deleted the no-named-args-parameterless branch November 24, 2026 08:53
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.

MethodSignatureMismatch on parameterless methods of a class tagged @no-named-arguments

1 participant