Skip to content

Run Psalm on the plugin in CI - #72

Merged
alies-dev merged 2 commits into
masterfrom
ci/psalm
Nov 11, 2026
Merged

alies-dev merged 2 commits into
masterfrom
ci/psalm

Conversation

@alies-dev

Copy link
Copy Markdown
Contributor

Context

Psalm never ran on the plugin itself in CI (#50). Run locally, it reported 122 issues: 37 in the WordPress and WP-CLI stubs from vendor, 7 in test.php (which demonstrates the plugin's own issues on purpose), and 78 in Plugin.php.

Stacked on #71: merge that first; this pull request then targets master.

Solution

  • A "Static analysis" job runs Psalm like the PHPUnit plugin does (--output-format=github --shepherd), on the latest stable Psalm so a change on Psalm's master can't turn it red.
  • InvalidDocblock is suppressed for vendor: those are docblocks of the bundled stubs, not of this plugin.
  • Fixed with Psalter: the plugin classes are final (ClassMustBeFinal) and overriding methods have #[\Override] (MissingOverrideAttribute). The attribute is ignored on PHP below 8.3.
  • The remaining 73 issues go to psalm-baseline.xml, so new code is checked and they can be fixed one by one. Most are RiskyTruthyFalsyComparison, UndefinedPropertyFetch on argument placeholders and uses of Psalm's internal classes; some may be real bugs, such as getDynamicHookName() returning an int despite its ?string return type.
  • findUnusedPsalmSuppress is on, as in the PHPUnit plugin.

Fixes #50

@alies-dev alies-dev added the release:internal The PR will be included in 'Internal changes' section of the release notes label Nov 11, 2026
@alies-dev alies-dev self-assigned this Nov 11, 2026
@alies-dev
alies-dev deleted the branch ci/coding-style November 11, 2026 14:24
@alies-dev alies-dev closed this Nov 11, 2026
@alies-dev alies-dev reopened this Nov 11, 2026
@alies-dev
alies-dev changed the base branch from ci/coding-style to master November 11, 2026 14:24
@alies-dev
alies-dev merged commit 1d87151 into master Nov 11, 2026
10 checks passed
@alies-dev
alies-dev deleted the ci/psalm branch November 11, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:internal The PR will be included in 'Internal changes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal: CI code style and psalm

1 participant