Skip to content
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

Inference estimation percentage glitch #3660

Closed
zerkms opened this issue Jun 24, 2020 · 5 comments
Closed

Inference estimation percentage glitch #3660

zerkms opened this issue Jun 24, 2020 · 5 comments
Labels

Comments

@zerkms
Copy link
Contributor

zerkms commented Jun 24, 2020

$ ./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>
@psalm-github-bot
Copy link

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

@weirdan weirdan added the bug label Jun 24, 2020
@muglug
Copy link
Collaborator

muglug commented Jun 24, 2020

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
Copy link
Contributor Author

zerkms commented Jun 24, 2020

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

@muglug
Copy link
Collaborator

muglug commented Jun 24, 2020

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

@zerkms
Copy link
Contributor Author

zerkms commented Jun 24, 2020

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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants