• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valkyrjaio / ci-phpstan-php / 30771422735
100%

Build:
DEFAULT BRANCH: 26.x
Ran 02 Aug 2026 11:03PM UTC
Jobs 1
Files 4
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Aug 2026 11:02PM UTC coverage: 100.0%. Remained the same
30771422735

push

github

web-flow
[Cache] fix(#174): Give each project its own cache directory (#175)

# Description

PHPStan fails in one repository with an error that names a directory in
another
repository:

```
Internal error:
"phar:///…/repro/A/.github/ci/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/…/SPL.stub"
is not a file while analysing file /…/repro/B/src/Thing.php
```

The developer never analyzed the repository that the path names.

Closes #174.

## The cause

PHPStan gives every project on a machine one cache directory,
`sys_get_temp_dir() . '/phpstan'`. A cache entry holds an absolute path
that
reaches inside `phpstan.phar`, and that `phar` belongs to whichever
project
wrote the entry. Every later project then reads a path that it does not
own.
Nothing fails while that directory exists. The error appears when the
first
project moves or goes away, and a git worktree makes that ordinary,
because a
developer removes a worktree when the work ends.

## The fix

`config.neon` sets `tmpDir` to a directory that belongs to one project.
The
value comes from `Valkyrja\PhpStan\Cache::getDirectory()`, which builds
`sys_get_temp_dir() . '/valkyrja-phpstan/' . md5(__DIR__)`.

The name comes from `__DIR__`. Composer installs this package into the
`vendor`
directory of each project, so `__DIR__` already identifies one project.
It also
stays correct when a developer runs PHPStan from another directory, and
it is
always a `string`, so the code carries no branch that a test cannot
reach.

Two limits come with the name, and the README records both. `__DIR__`
resolves a
symbolic link, so two projects that share one checkout through a
Composer `path`
repository also share one cache directory. Nothing removes a cache
directory
either, so a project that goes away leaves its directory behind.

Each project keeps a warm cache, so the change costs no speed after the
first
run.

### Why a PHP file holds the value

A `.neon` file cannot call a function, so the pat... (continued)

8 of 8 relevant lines covered (100.0%)

1.5 hits per line

Jobs
ID Job ID Ran Files Coverage
1 30771422735.1 02 Aug 2026 11:03PM UTC 4
100.0
GitHub Action Run
Source Files on build 30771422735
  • Tree
  • List 4
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #30771422735
  • ada134cc on github
  • Prev Build on 26.x (#30753313504)
  • Next Build on 26.x (#30771910543)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc