Skip to content

Commit de22776

Browse files
SanderMullerclaude
authored andcommitted
Run every rule on CollectedDataNode with -vvv
With -vvv the diagnose extensions print, and a rule can fill what they print only while it runs. The rule results are still saved for the next run. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 5586806 commit de22776

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎.github/workflows/e2e-tests.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ jobs:
226226
../bashunit assert contains 'Caller.php:10:Call to function ResultCacheCollectedDataRules\pure() on a separate line has no effect.' "$OUTPUT"
227227
echo "$OUTPUT" | grep -E 'Result cache reused the errors of ([0-9]+) of \1 rules on collected data\.'
228228
../bashunit assert contains 'Result cache was not rewritten because it is unchanged.' "$OUTPUT"
229+
# With -vvv the diagnose extensions print what the rules filled while they ran, so every rule runs.
230+
OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse -vvv --error-format raw")
231+
echo "$OUTPUT"
232+
../bashunit assert contains 'Caller.php:10:Call to function ResultCacheCollectedDataRules\pure() on a separate line has no effect.' "$OUTPUT"
233+
../bashunit assert not_contains 'Result cache reused the errors' "$OUTPUT"
229234
# src/Other.php is analysed again, but what it collects stays the same.
230235
echo '// changed' >> src/Other.php
231236
OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")

‎src/Command/AnalyseApplication.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public function analyse(
143143
$debug,
144144
$preRuleCallback,
145145
$postRuleCallback,
146-
$resultCache->getCollectedDataRuleResults(),
146+
// with -vvv the diagnose extensions print, and a rule can fill what they print only while it runs
147+
$errorOutput->isDebug() ? [] : $resultCache->getCollectedDataRuleResults(),
147148
);
148149
if ($finalizerResult->getReusedRulesCount() > 0 && $errorOutput->isVeryVerbose()) {
149150
$errorOutput->writeLineFormatted(sprintf(

0 commit comments

Comments
 (0)