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

Incorrect type stubs for Memcache #3841

Open
TysonAndre opened this issue Apr 8, 2020 · 0 comments
Open

Incorrect type stubs for Memcache #3841

TysonAndre opened this issue Apr 8, 2020 · 0 comments
Labels
enhancement This improves the quality of Phan's analysis of a codebase

Comments

@TysonAndre
Copy link
Member

TysonAndre commented Apr 8, 2020

Memcache::get has an incorrect signature in src/Phan/Language/Internal/FunctionSignatureMap.php. So do memcache_get and various other methods
https://www.php.net/manual/en/memcache.get.php

Also, that documentation on php.net is out of date - Memcache::get() is capable of returning many different types

'Memcache::get' => ['array', 'key'=>'string', 'flags='=>'array', 'keys='=>'array'],

Related to websupport-sk/pecl-memcache#64 - real types are extracted from reflection, phpdoc types from various sources

php > $x = new Memcache();
php > $x->addServer('127.0.0.1', 11211);
php > $x->get('test');
php > var_dump($x->get('test'));
bool(false)
php > var_dump($x->set('test', new ArrayObject()));
bool(true)
php > var_dump($x->get('test'));
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  array(0) {
  }
}
@TysonAndre TysonAndre added the enhancement This improves the quality of Phan's analysis of a codebase label Apr 8, 2020
TysonAndre added a commit that referenced this issue Jun 16, 2020
It's returning and accepting a Memcache object, not a resource.

For #3841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This improves the quality of Phan's analysis of a codebase
Projects
None yet
Development

No branches or pull requests

1 participant