简体   繁体   中英

How to make Psalm infer 100% of the codebase in PHP

Currently running Psalm gives me:

Psalm was able to infer types for 94.8665% of the codebase

How to debug where it couldn't infer the type? I'd like to have 100% type coverage.

Here's my psalm.xml.dist config:

<?xml version="1.0"?>
<psalm
    errorLevel="4"
    resolveFromConfigFile="true"
    totallyTyped="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>
            <file name="src/Kernel.php"/>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>
</psalm>

Thank you for your support.

Looks like this was "easy". Just had to lower the errorLevel down to 1 and fix all the issues. More than 500 in total.

As soon as I hit errorLevel=1 my code base was already 100% inferred.

Badges achieved:

  • type maniac
  • totally typed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM