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

Not working with the Redis extension #46

Open
mnapoli opened this issue Jan 26, 2016 · 9 comments
Open

Not working with the Redis extension #46

mnapoli opened this issue Jan 26, 2016 · 9 comments

Comments

@mnapoli
Copy link

mnapoli commented Jan 26, 2016

Maybe I'm doing it wrong but I cannot get this to work with the Redis extension. I'm running PHP 7, here is the list of warnings I'm getting:

Declaration of M6Web\Component\RedisMock\RedisMock_Redis_Adapter::scan(&$i_iterator, $str_pattern, $i_count) should be compatible with Redis::scan(&$i_iterator, $str_pattern = NULL, $i_count = NULL)
Declaration of M6Web\Component\RedisMock\RedisMock_Redis_Adapter::hscan($str_key, &$i_iterator, $str_pattern, $i_count) should be compatible with Redis::hscan($str_key, &$i_iterator, $str_pattern = NULL, $i_count = NULL)
Declaration of M6Web\Component\RedisMock\RedisMock_Redis_Adapter::zscan($str_key, &$i_iterator, $str_pattern, $i_count) should be compatible with Redis::zscan($str_key, &$i_iterator, $str_pattern = NULL, $i_count = NULL)
Declaration of M6Web\Component\RedisMock\RedisMock_Redis_Adapter::sscan($str_key, &$i_iterator, $str_pattern, $i_count) should be compatible with Redis::sscan($str_key, &$i_iterator, $str_pattern = NULL, $i_count = NULL)

I'm suspecting this is because the default value of internal/extension classes cannot be read (see Ocramius/ProxyManager#162 for example or also ParameterResolver.php#L97).

I'm wondering if it's sane to set a default value of null if we know there is a default value ($parameter->isOptional()) but we can't read it ($parameter->isDefaultValueAvailable())…

Has anyone managed to make this work with the Redis class of the Redis extension? (if so, which PHP version?)

@omansour
Copy link
Contributor

work fine with predis ~1.0 and php 7.0.1. Can you provide a simple test case ?

txs

@mnapoli
Copy link
Author

mnapoli commented Jan 26, 2016

Predis is the client implemented in vanilla PHP, I experience the problem with the Redis extension.

@omansour
Copy link
Contributor

yes. can you show me a simple test case ? So I can reproduce ? Or its just while running the tests of RedisMock ?

@mnapoli
Copy link
Author

mnapoli commented Jan 27, 2016

To reproduce:

$factory->getAdapter('Redis');

I've opened #47

@mojoLyon
Copy link
Contributor

@mnapoli you're right the problem come from reflection who can't read default value from internal function/method.

With isOptional ()we can know if a method has a default value but setting this with a null value can result in same error if some methods use constant as default parameter.

@mnapoli
Copy link
Author

mnapoli commented Jan 28, 2016

Yep but if null is the only default value in redis classes then this could be an acceptable solution. Unless you see another one? See Ocramius/ProxyManager#162 also.

@mojoLyon
Copy link
Contributor

Ok, if nullis the only default value in extension, your solution can fit

@omansour
Copy link
Contributor

omansour commented Feb 5, 2016

@mnapoli We will try to have a look at that issue today.

@mnapoli
Copy link
Author

mnapoli commented Feb 5, 2016

👍 cool!

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.

3 participants