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

OOM in psalter #4266

Closed
danog opened this issue Oct 1, 2020 · 1 comment
Closed

OOM in psalter #4266

danog opened this issue Oct 1, 2020 · 1 comment
Labels

Comments

@danog
Copy link
Collaborator

danog commented Oct 1, 2020

psalter OOMs with the following snippet: https://psalm.dev/r/21b0457ab9

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/21b0457ab9
<?php

/**
 * File callback interface.
 */
interface FileCallbackInterface
{
    /**
     * Get file.
     *
     * @return mixed
     */
    public function getFile();
    /**
     * Invoke callback.
     *
     * @param int $percent Percent
     * @param int $speed   Speed in mbps
     * @param int $time    Time
     *
     * @return mixed
     */
    public function __invoke($percent, $speed, $time);
}

class Test
{
    /**
     * @param mixed    $callable  Callable
     * @param callable $cb        Callback (DEPRECATED, use FileCallbackInterface)
     *
     * @return \Generator<array>
     */
    public function uploadFromCallable(callable $callable, $cb = null): void
    {
        if (\is_object($callable) && $callable instanceof FileCallbackInterface) {
            $cb = $callable;
            $callable = $callable->getFile();
        }
        if ($cb === null) {
            $cb = function ($percent) {
            };
        }
        $cb = function () use ($cb) {
            $cb(0);
        };
    }
}
Psalm output (using commit 6ad5e1c):

ERROR: MismatchingDocblockReturnType - 32:16 - Docblock has incorrect return type 'Generator<mixed, array<array-key, mixed>, mixed, mixed>', should be 'void'

ERROR: InvalidReturnType - 32:16 - No return statements were found for method Test::uploadFromCallable but return type 'Generator<mixed, array<array-key, mixed>, mixed, mixed>' was expected

@muglug muglug added the bug label Oct 2, 2020
@muglug muglug closed this as completed in c9e4745 Oct 2, 2020
danog pushed a commit to danog/psalm that referenced this issue Jan 29, 2021
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

2 participants