Open scollovati opened 3 months ago
Hi,
I'm encountering a similar issue, but in a different context. Here's the situation 😄
public function authenticate(string|false $code = false): ?string
Parameters should have "string|false" types as the only types passed to this method
In my project, I have only two calls to this method:
$accessToken = $this->service->oauth()->authenticate($code);
// and
$accessToken = $this->service->oauth()->authenticate();
I expect no error because false
is the default value.
To resolve this issue for now, I am explicitly setting the default value to false
:
$accessToken = $this->deezerClient->oauth()->authenticate(false);
Example:
Error wrongly reported:
Parameters should have "string" types as the only types passed to this method
Actually, the error message is misleading (reported here: https://github.com/rectorphp/type-perfect/issues/35#issuecomment-2217169072) but also wrong. The parameter should not be removed from the method signature.