Skip to content

Seed the PHPStan directory cache in cold test runs - #40

Merged
ChrisAbner merged 1 commit into
ChrisAbner:mainfrom
Golden007-prog:test/21-phpstan-scratch-cache
Nov 25, 2026
Merged

ChrisAbner merged 1 commit into
ChrisAbner:mainfrom
Golden007-prog:test/21-phpstan-scratch-cache

Conversation

@Golden007-prog

Copy link
Copy Markdown
Contributor

Initialize PHPStan’s test-only directory cache before the rule fixtures run. On a cold checkout, the first PHPStan class reads the cache before the file exists, which adds a recurring warning. Existing cache files and application settings are preserved. The test matrix now fails on warnings.

Closes #21.

On an exact clean checkout, the unmodified suite reported the missing directory-listings cache warning. With the patch and a fresh temporary directory, all 715 tests passed without warnings. Pint and PHPStan analysis also passed on PHP 8.5.

AI assisted with the change. I reproduced the warning and verified the cold-cache run locally.

@ChrisAbner ChrisAbner left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for picking this up, and sorry for the wait. I checked the seeded file against PHPStan's DirectoryWalker. It ignores a listings file without its format key and rewrites it, so the seed only removes the warning and never feeds PHPStan a stale listing. The suite passes cold with --fail-on-warning on PHP 8.4 and on 8.2 with --prefer-lowest, also on top of the upcoming 0.5.

@ChrisAbner
ChrisAbner merged commit 11375d8 into ChrisAbner:main Nov 25, 2026
16 checks passed
@ChrisAbner ChrisAbner mentioned this pull request Nov 25, 2026
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.

Test suite warns when PHPStan's cache is cold

2 participants