Open fluffycondor opened 3 years ago
Hey @fluffycondor, can you reproduce the issue on https://psalm.dev ?
Can you post the entire psalm.xml file please?
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
<file name="src/Kernel.php"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MissingConstructor>
<errorLevel type="suppress">
<directory name="src/DTO"/>
</errorLevel>
</MissingConstructor>
</issueHandlers>
<forbiddenFunctions>
<function name="dd"/>
<function name="dump"/>
</forbiddenFunctions>
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
<pluginClass class="Weirdan\DoctrinePsalmPlugin\Plugin"/>
</plugins>
</psalm>
Psalm is outputting cached errors here - I've seen it when I manually scanned a file outside the projectFiles, and then re-run Psalm with no files specified on the command line.
Psalmtemp_folder
is not a Psalm's folder though - it's created by PHPStorm Psalm plugin.
Workaround is to clear the cache: psalm --clear-cache
.
We should probably filter out cached errors for files that are not on the list of files for the current run.
IMHO, we should not even try to use the same cache if the command line or xml config has changed between two calls.
Well, I would like cache built with $ psalm
to be used when I run $ psalm path/to/file.php
, if path/to/file.php
is in project files. Otherwise lint-on-save is going to be quite a bit slower.
@weirdan a few days ago, I observed that doctrine's plugin can't find entities when the repository isn't part of the analysis. So when launched on a single file, it can throw UndefinedClass that stays in cache when running the full analysis. Not sure if Psalm core can react the same way though...
Psalm 4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69 Psalm for some reason is scanning its own temp folder that located outside the project directory.
In the project itself this kind of errors are suppressed:
This error appears kinda inconsistent, but if it appears only way to get rid of it is to delete psalm temp folder (Psalmtemp_folder1430 in this case).