I was wondering: is there a way to suppress all issues from a directory?
I have following issue (the issue is located in vendor directory, I guess because I extend this class):
ERROR: UndefinedClass - vendor/zendframework/zend-feed/src/Reader/Reader.php:54:13 - Class or interface Zend\Cache\Storage\StorageInterface does not exist
/**
* Cache instance
*
* @var CacheStorage
*/
protected static $cache = null;
I know that I can use the specific issue config suppression, but would it be a nice feature to be able to suppress all issues in a directory e.g. vendor in my case?
You can remove vendor dir issues by adding
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
to the <projectFiles> element in your config.
You're right that you're only seeing that issue because you extend that class.
I've made it so Psalm will ignore issues in vendor by default when initialising a config file.
But what do you write when you want to ignore more directories?
I have:
<ignoreFiles>
<directory name="database" />
<directory name="vendor" />
<directory name="tests" />
</ignoreFiles>
and it only ignores the vendor folder :-(
I aslo tried:
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="./database" />
</errorLevel>
</PropertyNotSetInConstructor>
and
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="database" />
</errorLevel>
</PropertyNotSetInConstructor>
without any effect
Can we please re-open this? I'm running into the same issue with the latest release of Psalm.
When adding the vendor-folder to the ignoreFiles section, I get a lot of errors due to MissingDependency in my test-folder as psalm seems not to be able to find the PHP-Unit TestCase-file. So this solution seems not to be the one we are looking for...
Most helpful comment
When adding the vendor-folder to the
ignoreFilessection, I get a lot of errors due toMissingDependencyin my test-folder as psalm seems not to be able to find the PHP-Unit TestCase-file. So this solution seems not to be the one we are looking for...