Skip to content

Replace Psalm with PHPStan - #60

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

Summary by Sourcery

Replace Psalm with PHPStan as the project’s static analysis tool.

Enhancements:

  • Replace Psalm with PHPStan for project static analysis and update the codebase configuration accordingly.

Build:

  • Replace the Psalm development dependency and script with PHPStan.

CI:

  • Run PHPStan in static-analysis and mutation workflow triggers, and extend static analysis coverage to PHP 8.6.

Documentation:

  • Update internal documentation to reference PHPStan commands and remove the obsolete type-coverage badge.

Chores:

  • Remove the Psalm configuration and adapt type annotations and suppressions for PHPStan.

@sourcery-ai

sourcery-ai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Annotate the lock-key list and replace the Psalm suppression with PHPStan ignores, retaining the explanation for why unpack() cannot fail.

  • src/PgsqlMutex.php L21, L35-40

Configuration

Replace Psalm with PHPStan in development dependencies, Composer scripts, analysis configuration, and CI, including adding the latest PHP version to the CI matrix.

  • .gitattributes L33
  • .github/workflows/mutation.yml L11
  • .github/workflows/static.yml L8, L18-19, L25
  • composer.json L37, L42 (removed lines), L64
  • phpstan.neon L1-4
  • psalm.xml (deleted)

Documentation

Update the internal static-analysis instructions, remove the obsolete type-coverage badge, and record the tool change in the changelog.

  • CHANGELOG.md L5
  • docs/internals.md L21-24
  • 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

@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 100.00%. Comparing base (68af04b) to head (7c1913b).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #60   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity         7         7           
===========================================
  Files              2         2           
  Lines             26        26           
===========================================
  Hits              26        26           

☔ 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 marked this pull request as ready for review November 22, 2026 07:26

@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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/static.yml" line_range="19" />
<code_context>
-  psalm:
-    uses: yiisoft/actions/.github/workflows/psalm.yml@master
+  phpstan:
+    uses: yiisoft/actions/.github/workflows/phpstan.yml@master
     with:
       extensions: pdo, pdo_pgsql
</code_context>
<issue_to_address>
**Static analysis check fails**

When the new PHPStan job analyzes `src/PgsqlMutex.php`, pHPStan reports calls on `PDOStatement|false`: `acquireLock()` and `releaseLock()` dereference the results of `PDO::prepare()` without checking them. Since the new configuration scans `src` at maximum level, the static-analysis job fails.

Check that each `PDO::prepare()` result is not false before calling methods on it.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: .github/workflows/static.yml:19


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

psalm:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
phpstan:
uses: yiisoft/actions/.github/workflows/phpstan.yml@master

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Critical · Static analysis check fails

When the new PHPStan job analyzes src/PgsqlMutex.php, pHPStan reports calls on PDOStatement|false: acquireLock() and releaseLock() dereference the results of PDO::prepare() without checking them. Since the new configuration scans src at maximum level, the static-analysis job fails.

Check that each PDO::prepare() result is not false before calling methods on it.

Prompt for AI agents
In `.github/workflows/static.yml` at line 19:

**Static analysis check fails**

When the new PHPStan job analyzes `src/PgsqlMutex.php`, pHPStan reports calls on `PDOStatement|false`: `acquireLock()` and `releaseLock()` dereference the results of `PDO::prepare()` without checking them. Since the new configuration scans `src` at maximum level, the static-analysis job fails.

Check that each `PDO::prepare()` result is not false before calling methods on it.

@vjik
vjik merged commit 4728cff into master Nov 22, 2026
31 checks passed
@vjik
vjik deleted the phpstan branch November 22, 2026 07: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