Skip to content

Restore the @return types of the static analysis tests - #368

Merged
shadowhand merged 2 commits into
webmozarts:masterfrom
Amoifr:fix-360-static-analysis-return-types
Oct 2, 2026
Merged

shadowhand merged 2 commits into
webmozarts:masterfrom
Amoifr:fix-360-static-analysis-return-types

Conversation

@Amoifr

@Amoifr Amoifr commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #360.

b5addd4 removed the @return annotations from tests/static-analysis/, so the suite only checked the native iterable/string types and no longer what Psalm infers from each assertion. This restores the 142 precise ones (the @return mixed lines are left out, the native types cover them) and regenerates the non-return/ variants, which now check the @psalm-assert narrowing against them.

Restoring them right away caught two things:

  • propertyExists() lost the class-string of its argument: unlike propertyNotExists() and methodExists(), it had no @template T as class-string|object. It now has the same template, and Mixin.php is regenerated.
  • allNullOrThrows() declared @return iterable<Closure> for an iterable<Closure|null> input, a test mistake that the missing return check had hidden.

Psalm is clean, and without the propertyExists() change it reports 8 errors. PHPUnit is green, ProjectCodeTest included.

@shadowhand
shadowhand merged commit 11b3220 into webmozarts:master Oct 2, 2026
9 checks passed
@shadowhand

Copy link
Copy Markdown
Collaborator

Thanks!

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.

Static analysis suite rendered useless by past refactoring?

2 participants