-
-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Result cache metadata can be different just by adding --generate-baseline #8778
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
I think it's better to create a repository to reproduce what you want. |
I don't think we need a reproduction. A call to |
I wanted to ask you about the cache, but this does not apply to this topic. Recently I had to use analysis without a cache and did not find anything about it in the help. And I know about the page https://phpstan.org/user-guide/command-line-usage#--help and what it says in the description for this option. $ phpstan --help | grep cache It would be better to get all the necessary and up-to-date information from the help, do you agree? I think this is not so difficult to do, if of course you are interested in it. |
@metaliciouz Please don't hijack unrelated threads, and open a separate discussion or issue instead. |
Sorry, didn't think about that. |
@schlndh thanks for the great repro steps. I was able to reproduce and sent over a fix in in my tests the baseline generation after a successfull analysis runs considerably faster now |
Fixed: phpstan/phpstan-src#2606 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
I like to run
phpstan analyse
first to see the new issues and thenphpstan analyse --generate-baseline
, which should be almost instantaneous thanks to the result cache. However, in my setup the cache is not reused for--generate-baseline
. I found out that it starts working when I swap the two includes at the beginning of my config:If I have it like this and run
phpstan clear-result-cache -vvv; phpstan analyse -vvv; phpstan analyse -vvv --generate-baseline
I get:I think the problem is this. Since the
other.neon
declares services, the order ofparameters
andservices
in the$currentMeta['projectConfig']
depends on whether the baseline is loaded or not. If it is loaded thenparameters
are first, otherwiseservices
are first.Ideally, the config keys should be sorted such that this doesn't happen.
Code snippet that reproduces the problem
Create
dir/file.php
(any php code will do),dir/phpstan.neon
,dir/phpstan-baseline.neon
anddir/other.neon
.Run
phpstan clear-result-cache; phpstan analyse -vvv; phpstan analyse -vvv --generate-baseline
indir
.at the end of
isMetaDifferent
gives me:Expected output
The cache should be reused with
--generate-baseline
, unless something else changes.The text was updated successfully, but these errors were encountered: