Skip to content

Replace Psalm with PHPStan - #171

Merged
vjik merged 2 commits into
masterfrom
phpstan
Nov 22, 2026
Merged

vjik merged 2 commits into
masterfrom
phpstan

Conversation

@vjik

@vjik vjik commented Nov 22, 2026 •

Copy link
Copy Markdown
Member
Q A
Is bugfix? ❌
New feature? ❌
Breaks BC? ❌

Summary by Sourcery

Replace Psalm with PHPStan for static analysis across the project.

Enhancements:

  • Replace Psalm with PHPStan as the project's static analysis tool and update type annotations and analysis-related suppressions accordingly.

Build:

  • Add PHPStan as a development dependency and expose it through the Composer scripts.

CI:

  • Switch the static analysis workflow and its configuration trigger from Psalm to PHPStan.

Documentation:

  • Update static analysis documentation to reference PHPStan and remove the obsolete type-coverage badge.

Chores:

  • Remove the obsolete Psalm configuration and tooling files.

@sourcery-ai

sourcery-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Sorry @vjik, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Update PHPDoc types on the public message reader, writer, and formatter interfaces to use PHPStan-compatible annotations.

  • src/MessageFormatterInterface.php L16, L18 (removed lines)
  • src/MessageReaderInterface.php L19, L29
  • src/MessageWriterInterface.php L17, L33 (removed lines)
  • src/TranslatorInterface.php L38, L54 (removed lines), L59 (removed lines)

Replace Psalm-specific type annotations with PHPStan-compatible types on message sources and the translator’s internal state.

  • src/CategorySource.php L48-118 (4 small edits)
  • src/InMemoryMessageSource.php L15, L30
  • src/Translator.php L22, L27, L107-109

API

Document the message parameter type on the ID reader’s public implementation.

  • src/IdMessageReader.php L14-16

Implementation

Adapt the extractor’s token and result annotations for PHPStan, including the skipped-line data shape.

  • src/Extractor/ContentParser.php L24-290 (16 small edits)
  • src/Extractor/TranslationExtractor.php L23-106 (4 small edits)

Remove Psalm-only suppressions and simplify equivalent constructor, transaction, and random-string logic in the extractor example code.

  • tests/ConfigTest.php L62
  • src/SimpleMessageFormatter.php L20 (removed lines), L22 (removed lines)
  • tests/extractorExamples/user-main/src/Form/FormEmailChange.php L23 (removed lines)
  • tests/extractorExamples/user-main/src/Repository/RepositoryToken.php L62 (removed lines)
  • tests/extractorExamples/user-main/src/Repository/RepositoryUser.php L42 (removed lines), L55 (removed lines), L184 (removed lines)

Configuration

Replace Psalm with PHPStan in the static-analysis workflow and configure the relevant workflow path trigger.

  • .github/workflows/static.yml L9, L23-24

Add PHPStan as a development dependency and Composer command, and remove the obsolete Psalm configuration and tooling.

  • composer.json L39, L89
  • phpstan.neon L1-4
  • psalm.xml (deleted)
  • tools/psalm/composer.json (deleted)

Documentation

Update the static-analysis documentation and changelog, and remove the Psalm-specific type-coverage badge.

  • CHANGELOG.md L5
  • docs/internals.md L22-25
  • README.md L15 (removed lines)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.35%. Comparing base (c4c8605) to head (8edfa35).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #171      +/-   ##
============================================
- Coverage     99.35%   99.35%   -0.01%     
+ Complexity      113      112       -1     
============================================
  Files            14       14              
  Lines           309      308       -1     
============================================
- Hits            307      306       -1     
  Misses            2        2              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vjik
vjik merged commit 861e717 into master Nov 22, 2026
47 checks passed
@vjik
vjik deleted the phpstan branch November 22, 2026 16:33
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.

1 participant