Skip to content

Inference estimation percentage glitch #3660

@zerkms

Description

@zerkms
Contributor
$ ./vendor/bin/psalm|head
Scanning files...
Analyzing files...

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 60 / 88 (68%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░
------------------------------
No errors found!
------------------------------

Checks took 1.27 seconds and used 309.727MB of memory
Psalm was able to infer types for 100.0739% of the codebase

psalm version: 3.12.1

psalm.xml:

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

Activity

psalm-github-bot

psalm-github-bot commented on Jun 24, 2020

@psalm-github-bot

Hey @zerkms, can you reproduce the issue on https://psalm.dev ?

muglug

muglug commented on Jun 24, 2020

@muglug
Collaborator

I'd be interested in the result of --stats – it should show the file or files with > 100% (I think where the number of mixed types is negative)

zerkms

zerkms commented on Jun 24, 2020

@zerkms
ContributorAuthor

Yep, there are several files with > than 100% and negative mixed.

muglug

muglug commented on Jun 24, 2020

@muglug
Collaborator

Do you have assert calls after otherwise-mixed assertions in those files?

zerkms

zerkms commented on Jun 24, 2020

@zerkms
ContributorAuthor

I have narrowed it down. In my case in one piece of code it was triggered by

            /** @var ?ResponseReceived $lastResponseReceived */
            $lastResponseReceived = null;
            $api->addListener(ResponseReceived::class, static function(Event $e) use(&$lastResponseReceived) {
                if (!$e instanceof ResponseReceived) {
                    return;
                }
                $lastResponseReceived = $e;
            });
            ...
            Assert::isInstanceOf($lastResponseReceived, ResponseReceived::class);
            $stopwatch->apiRequestResponse($lastResponseReceived);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @weirdan@zerkms@muglug

        Issue actions

          Inference estimation percentage glitch · Issue #3660 · vimeo/psalm