Navigation Menu

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

Preserve __call() types info #358

Closed
quasilyte opened this issue Feb 26, 2020 · 1 comment · Fixed by #359
Closed

Preserve __call() types info #358

quasilyte opened this issue Feb 26, 2020 · 1 comment · Fixed by #359

Comments

@quasilyte
Copy link
Contributor

Code Example

class Magic {
  public function __call() { return $this; }
  public function notMagic() { return 10; }
}

$m = new Magic();
$m->magic1()->magic2()->notMagic();

Actual Behavior

$m->magic1() inferred to mixed and "undefined method {mixed}->magic2` is reported.

Expected Behavior

No warnings.

@quasilyte
Copy link
Contributor Author

Partially addresses #354.
The other part is to add @method support.

quasilyte added a commit that referenced this issue Feb 26, 2020
Fixes #358

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
quasilyte added a commit that referenced this issue Feb 26, 2020
Preserve __call() and __callStatic() types info.
Use @method annotations to load additional instance
and static methods info in a same way as we do it
for @Property annotation.

All auto-generated func infos have a pos set to
a class position.

Fixes #358

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
quasilyte added a commit that referenced this issue Feb 26, 2020
Preserve __call() and __callStatic() types info.
Use @method annotations to load additional instance
and static methods info in a same way as we do it
for @Property annotation.

All auto-generated func infos have a pos set to
a class position.

Fixes #358
Fixes #360

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
quasilyte added a commit that referenced this issue Feb 28, 2020
Preserve __call() and __callStatic() types info.
Use @method annotations to load additional instance
and static methods info in a same way as we do it
for @Property annotation.

All auto-generated func infos have a pos set to
a class position.

Fixes #358
Fixes #360

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>

* src/linter: add class phpdoc parsing tests

Moved a few phpdoc-related methods from RootWalker to
functions in phpdoc_util.go.

Added CurrentFile field to class parse state to make
it easier to pass required context into these functions.
Since RootWalker always has parser state, I removed
filename field from it.

Also made collectMethodCallTypes return its out map
parameter, so the effects of it are more obvious from
the caller side.

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant