Skip to content

Test the non-parse exception that stops the result cache save with a rule - #6729

Merged
ondrejmirtes merged 1 commit into
phpstan:2.3.xfrom
SanderMuller:result-cache-parse-error-e2e
Oct 23, 2026
Merged

ondrejmirtes merged 1 commit into
phpstan:2.3.xfrom
SanderMuller:result-cache-parse-error-e2e

Conversation

@SanderMuller

@SanderMuller SanderMuller commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

The result-cache-parse-error e2e job fails on 2.3.x, for example in this run on f064084. It passed on 28f54de and has failed since the next commit, the BetterReflection update in 613b1b1.

Its last part copies in a class that extends itself and expects Result cache was not saved because of non-ignorable exception: Reflection error: Circular reference. That update brings in ondrejmirtes/BetterReflection@34da89e, which gives a class on an inheritance cycle no parent instead of throwing CircularReference. PHPStan now reports nothing for that class, so the run exits with 0 and the step fails.

That part tested one branch of the save from #6694: an exception other than a parse error still stops the save. This PR tests the same branch with a rule that throws ClassNotFoundException, in the result-cache-internal-error fixture, which already loads its own rule. It removes the cycle part and loop/Loop.php from the parse-error fixture.

I ran both steps locally as the workflow runs them. On 2.3.x the parse-error step fails with exit code 0. On this branch both steps pass. To check that the new part tests that branch, I changed the condition so that every exception is handled like a parse error. The step then failed on the new assertion, because the result cache was saved.

#6712, which reports inheritance cycles with a rule, also changes the cycle part of this step. If this PR is merged first, I will rebase #6712 on it.

🤖 Generated with Claude Code

…rule

Since the BetterReflection update in 613b1b1, a class that extends
itself is no longer a reflection error, so the last part of the
result-cache-parse-error e2e test failed. A rule that throws
ClassNotFoundException now tests the same branch of the save, in the
result-cache-internal-error fixture.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@SanderMuller
SanderMuller force-pushed the result-cache-parse-error-e2e branch from c8e8ec2 to 0e38edf Compare October 23, 2026 19:59
@ondrejmirtes
ondrejmirtes merged commit bb2b515 into phpstan:2.3.x Oct 23, 2026
583 checks passed
@ondrejmirtes

Copy link
Copy Markdown
Member

Thank you!

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.

2 participants