-
Notifications
You must be signed in to change notification settings - Fork 660
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
Psalm 5 cache is unstable #8874
Comments
@kkmuffme you've done a lot of work on caching lately, perhaps this may interest you. |
Please create a reproduction repo I can't reproduce this issue in our environment atm |
Trying to work on a reproduction repo, but seems hard to reproduce. But something I just noticed, all the issues it is reporting are in the baseline. So something about using the cache causes the baselined issues to not be ignored. |
I did see a similar issue in Psalm's own codebase. |
> ./psalm # run with a cache, no files changed
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
------------------------------
No errors found!
------------------------------
217 other issues found.
You can display them with --show-info=true
------------------------------
Checks took 0.13 seconds and used 68.385MB of memory
No files analyzed
Psalm was able to infer types for 99.8722% of the codebase
> vim src/Psalm/Config.php # edit the file - I just added a bunch of empty lines in `use` block
> ./psalm # run Psalm again
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 60 / 263 (22%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 120 / 263 (45%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 180 / 263 (68%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 240 / 263 (91%)
░░░░░░░░░░░░░░░░░░░░░░░
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:86:12 - Cannot find any references to property Psalm\Type\MutableUnion::$initialized_class (see https://psalm.dev/149)
public $initialized_class;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:98:12 - Cannot find any references to property Psalm\Type\MutableUnion::$failed_reconciliation (see https://psalm.dev/149)
public $failed_reconciliation = false;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:157:12 - Cannot find any references to property Psalm\Type\MutableUnion::$from_template_default (see https://psalm.dev/149)
public $from_template_default = false;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:186:12 - Cannot find any references to property Psalm\Type\MutableUnion::$by_ref (see https://psalm.dev/149)
public $by_ref = false;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:191:12 - Cannot find any references to property Psalm\Type\MutableUnion::$reference_free (see https://psalm.dev/149)
public $reference_free = false;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:196:12 - Cannot find any references to property Psalm\Type\MutableUnion::$allow_mutations (see https://psalm.dev/149)
public $allow_mutations = true;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/MutableUnion.php:201:12 - Cannot find any references to property Psalm\Type\MutableUnion::$has_mutations (see https://psalm.dev/149)
public $has_mutations = true;
ERROR: PossiblyUnusedProperty - src/Psalm/Type/Union.php:132:12 - Cannot find any references to property Psalm\Type\Union::$ignore_isset (see https://psalm.dev/149)
public $ignore_isset = false;
------------------------------
8 errors found
------------------------------
217 other issues found.
You can display them with --show-info=true
------------------------------
Checks took 4.53 seconds and used 948.602MB of memory
Psalm was able to infer types for 99.8690% of the codebase The change I introduced was real trivial: diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php
index ee172a430..88c831d8c 100644
--- a/src/Psalm/Config.php
+++ b/src/Psalm/Config.php
@@ -4,6 +4,15 @@ namespace Psalm;
use Composer\Autoload\ClassLoader;
use Composer\Semver\Constraint\Constraint;
+
+
+
+
+
+
+
+
+
use Composer\Semver\VersionParser;
use DOMAttr;
use DOMDocument; |
@weirdan so the problem is with the baseline? (I assume those errors are ignored via psalm's baseline?) If yes, I can't help much, bc we don't use a baseline and I'm in crunch time until January |
Yes, all of those are ignored through the baseline (and it's the only occurrences of |
Turns out there are no problems with the baseline itself. The Psalm emits (almost) the same error twice in this case, and baseline correctly suppresses only one occurrence:
|
This also allows (Possibly)UnusedProperty to be suppressed with `referencedProperty` attribute in psalm.xml Fixes vimeo#8874
The follow has been frustrating:
The text was updated successfully, but these errors were encountered: