简体   繁体   English

如何让 Psalm 推断出 PHP 中 100% 的代码库

[英]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 Psalm 能够推断出 94.8665% 的代码库的类型

How to debug where it couldn't infer the type?如何在无法推断类型的地方进行调试? I'd like to have 100% type coverage.我想要 100% 的类型覆盖率。

Here's my psalm.xml.dist config:这是我的psalm.xml.dist配置:

<?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.只需将errorLevel降低到 1 并修复所有问题。 More than 500 in total.总共超过500个。

As soon as I hit errorLevel=1 my code base was already 100% inferred.一旦我点击errorLevel=1 ,我的代码库就已经 100% 被推断出来了。

Badges achieved:获得的徽章:

  • type maniac类型狂人
  • totally typed完全打字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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