Skip to content

Fix unmatched PHPStan ignore on ext-mongodb 1.x - #3555

Merged
GromNaN merged 1 commit into
mongodb:5.xfrom
GromNaN:fix/phpstan-unmatched-ignore-driver1
Jul 28, 2026
Merged

Fix unmatched PHPStan ignore on ext-mongodb 1.x#3555
GromNaN merged 1 commit into
mongodb:5.xfrom
GromNaN:fix/phpstan-unmatched-ignore-driver1

Conversation

@GromNaN

@GromNaN GromNaN commented Jul 27, 2026

Copy link
Copy Markdown
Member

The PHP/8.4 Driver/1 static-analysis job fails with:

src/MongoDBServiceProvider.php:91
No error with identifier arguments.count is reported on line 91.

The inline @phpstan-ignore arguments.count added in #3529 for the getPrefix() call is unmatched when analysing against ext-mongodb 1.x, because the type resolution differs from ext-mongodb 2.x and PHPStan does not emit the underlying arguments.count error there.

Move the ignore to phpstan.neon.dist with reportUnmatched: false so it silently applies on driver 2 without failing on driver 1.

Reproduced locally with PHP 8.4 and ext-mongodb 1.21.5; PHPStan now reports [OK] No errors on both driver flavors.

Copilot AI review requested due to automatic review settings July 27, 2026 16:11
@GromNaN
GromNaN requested a review from a team as a code owner July 27, 2026 16:11
@GromNaN
GromNaN requested a review from paulinevos July 27, 2026 16:11

Copilot AI 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.

Pull request overview

This PR fixes a PHPStan failure in the PHP/8.4 Driver/1 static-analysis job by removing an inline unmatched @phpstan-ignore and instead configuring a conditional ignore in phpstan.neon.dist that won’t error when unmatched on ext-mongodb 1.x.

Changes:

  • Removed the inline @phpstan-ignore arguments.count on the getPrefix() call in MongoDBServiceProvider.
  • Added a PHPStan ignoreErrors entry for arguments.count scoped to src/MongoDBServiceProvider.php with reportUnmatched: false to avoid failures when the error is not emitted (driver 1.x).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/MongoDBServiceProvider.php Removes the inline @phpstan-ignore to prevent unmatched-ignore failures on driver 1.x.
phpstan.neon.dist Adds a config-based ignore for arguments.count with reportUnmatched: false to keep analysis green across driver versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phpstan.neon.dist
The inline @PHPStan-Ignore arguments.count on MongoDBServiceProvider
is reported as unmatched by PHPStan on the PHP/8.4 Driver/1 matrix job,
because ext-mongodb 1.x does not trigger the underlying arguments.count
error. Move the ignore to phpstan.neon.dist with reportUnmatched: false
so it silently applies when relevant and does not fail the build otherwise.
@GromNaN
GromNaN force-pushed the fix/phpstan-unmatched-ignore-driver1 branch from 51590ce to 5b7381c Compare July 27, 2026 16:42
@GromNaN
GromNaN enabled auto-merge (squash) July 27, 2026 17:02
@GromNaN
GromNaN merged commit c46115d into mongodb:5.x Jul 28, 2026
30 checks passed
@GromNaN
GromNaN deleted the fix/phpstan-unmatched-ignore-driver1 branch July 28, 2026 12:14
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.

3 participants