Skip to content

Fix: phpdoc cache collision with identical aliases & variable names#471

Merged
ondrejmirtes merged 7 commits intophpstan:masterfrom
rainbow-alex:fix/phpdoc-cache-collision
Mar 13, 2021
Merged

Fix: phpdoc cache collision with identical aliases & variable names#471
ondrejmirtes merged 7 commits intophpstan:masterfrom
rainbow-alex:fix/phpdoc-cache-collision

Conversation

@rainbow-alex
Copy link
Copy Markdown
Contributor

/** @var Foo $x */ in the global scope was cached once for all files, but it can have different semantics depending on the imports used in each file.

I can't provide a playground link because the bug requires multiple files. Please see the test coverage I added for an example.

@rainbow-alex rainbow-alex force-pushed the fix/phpdoc-cache-collision branch from 68be122 to b34321b Compare March 13, 2021 13:25
@ondrejmirtes
Copy link
Copy Markdown
Member

The build failures might be solvable by bumping the cache version number here: https://github.com/phpstan/phpstan-src/pull/471/files#diff-34511260e902425b48cdc48e7434a8768e633d194e55a1273569d20b8310efceR219

@ondrejmirtes
Copy link
Copy Markdown
Member

This line needs to change: $cacheKey = sprintf('%s-phpdocstring-v7-generic-traits', $fileName);

@rainbow-alex rainbow-alex force-pushed the fix/phpdoc-cache-collision branch from 0f447ca to f90ef9e Compare March 13, 2021 17:52
@ondrejmirtes ondrejmirtes merged commit 978bcdf into phpstan:master Mar 13, 2021
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

@rainbow-alex rainbow-alex deleted the fix/phpdoc-cache-collision branch March 13, 2021 18:54
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.

2 participants