phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Allow configuring tmpDir using PHPSTAN_TMPDIR environment variable

Open Jeroeny opened this issue 3 years ago • 2 comments

It'd be useful if the tmpDir is configurable using an environment variable. Right now it's only configurable in phpstan.neon > parameters > tmpDir. For example projects without tmpDir configured for the user, could still have/need a consistent tmpDir in CI. This way we can more easily persist the cache result for multiple projects, for subsequent CI runs.

Alternatively this could be implemented using a command option (analyse --tmpDir=..)

Jeroeny avatar Sep 09 '22 13:09 Jeroeny

there is another proposal which might also fix your problem: https://github.com/phpstan/phpstan-src/pull/1469

the PR will use a better default logic so phpstan will in the end use a separate result-cache per phpstan-config.

could you check whether this would also work for you?

staabm avatar Sep 09 '22 15:09 staabm

@staabm that seems to be a different usecase. I would actually want different cache directories depending on the context the analysis is running in.

Jeroeny avatar Sep 09 '22 17:09 Jeroeny

Hi, environment- and machine-specific configuration options are already possible via: https://phpstan.org/config-reference#multiple-files

Alternative proposal and more general one is to allow any environment variable to be referenced in the configuration.

ondrejmirtes avatar Oct 16 '22 10:10 ondrejmirtes