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

PHPDoc methods are not recognized in @mixin #3534

Closed
SCIF opened this issue Jun 6, 2020 · 1 comment
Closed

PHPDoc methods are not recognized in @mixin #3534

SCIF opened this issue Jun 6, 2020 · 1 comment
Labels

Comments

@SCIF
Copy link
Contributor

SCIF commented Jun 6, 2020

https://psalm.dev/r/ce8bedacc5
L33 shows real methods recognized fine while PHPDoc one on L35 is failed

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/ce8bedacc5
<?php

/**
* @template T
* @mixin T
*/
class Builder {
        public function __call($method, $parameters) {}

    public static function __callStatic($method, $parameters) {}

}

/**
* @method self active()
*/
class Model {
    /** @return Builder<static> */
    public function query(): Builder {}
    
    public function published(): self {}
    
    public function __call($method, $parameters) {}

    public static function __callStatic($method, $parameters) {}
}


$m = new Model;
/** @psalm-trace $q */
$q = $m->query();
/** @psalm-trace $p */
$p = $q->published();
/** @psalm-trace $a */
$a = $q->active();
Psalm output (using commit 438eb17):

INFO: Trace - 31:1 - $q: Builder<Model&static>

INFO: Trace - 33:1 - $p: Model

INFO: MixedAssignment - 35:1 - Unable to determine the type that $a is being assigned to

INFO: Trace - 35:1 - $a: mixed

INFO: MissingParamType - 8:32 - Parameter $method has no provided type

INFO: MissingParamType - 8:41 - Parameter $parameters has no provided type

INFO: MissingParamType - 10:41 - Parameter $method has no provided type

INFO: MissingParamType - 10:50 - Parameter $parameters has no provided type

ERROR: InvalidReturnType - 18:17 - No return statements were found for method Model::query but return type 'Builder<Model>' was expected

ERROR: InvalidReturnType - 21:34 - Not all code paths of Model::published end in a return statement, return type Model expected

INFO: MissingParamType - 23:28 - Parameter $method has no provided type

INFO: MissingParamType - 23:37 - Parameter $parameters has no provided type

INFO: MissingParamType - 25:41 - Parameter $method has no provided type

INFO: MissingParamType - 25:50 - Parameter $parameters has no provided type

@muglug muglug added the bug label Jun 6, 2020
@muglug muglug closed this as completed in 0ac739f Jun 7, 2020
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