Skip to content

fix(test): keep resolver cache assertions PHPStan 2.2 safe - #260

Merged
Björn Meyer (BrocksiNet) merged 1 commit into
mainfrom
fix/phpstan-2-2-resolver-test
Sep 28, 2026
Merged

Björn Meyer (BrocksiNet) merged 1 commit into
mainfrom
fix/phpstan-2-2-resolver-test

Conversation

@BrocksiNet

Copy link
Copy Markdown
Contributor

PHPStan resolves to 2.2.x now (^2.1 constraint, no committed lock), and it reports two errors in SalesChannelTypeResolverTest that turn php-quality, sdk-main-compatibility and future-compatibility red on every open PR (#249, #253, #258, #259):

Call to static method Assert::assertSame() with ...::Storefront and ...::Storefront will always evaluate to true.

The caching tests call assertSame(X, $resolver->resolve('id')) twice in a row. The first assertion narrows the $resolver->resolve('id') expression, so PHPStan treats the second as already known. Marking resolve() @phpstan-impure does not help; 2.2 still flags back-to-back asserts on the same call expression, and it would add an "impure without side effects" error on the static test fixture.

The tests now store both results before asserting. The single repository read remains proven by expectedReads: 1.

PHPStan 2.2 reports a second assertSame() on the same resolve() call
expression as always true, because the first assertion narrowed that
expression. Store both results before asserting; the single repository
read is still proven by expectedReads.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T11:24:54.777760Z 08defca PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BrocksiNet
Björn Meyer (BrocksiNet) merged commit 7f8fb0e into main Sep 28, 2026
27 checks passed
@BrocksiNet
Björn Meyer (BrocksiNet) deleted the fix/phpstan-2-2-resolver-test branch September 28, 2026 06:59
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