-
Notifications
You must be signed in to change notification settings - Fork 24
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
Cannot redeclare Safe\array_combine() in PHPStan and Safe 2.0 #29
Comments
Hi @webard, do you have a public repo where this is reproducable so I can investigate? |
Hi, unfortunately that is private repo. How can I help you? |
Everything is fine with versions:
With versions:
I found something weird. I use laravel v8.79, and these packages:
error with
|
Problem occurs when use |
Very strange.. not quite sure what would be the cause. I'm glad you found a workaround for now. I think perhaps the actual cause is located in the Safe library itself, not in the phpstan plugin. |
Because the issue related to the safe library itself has been closed and people are being redirected here (by the last comment) I would like to clarify how to easily reproduce this issue. I do believe this has nothing to do with this repo, but because of the above mentioned redirect: I created a new laravel project with
Which resulted in these versions:
Added a simple class: <?php
declare(strict_types=1);
namespace App;
use Safe\Exceptions\NetworkException;
final class LarastanTest
{
/**
* @throws NetworkException
*/
public function testDnsRecord(): void
{
$dns = \Safe\dns_get_record('https://foo.bar');
}
} And a phpstan.neon conf file:
I ran into this error:
BUT when I remove the include for So I guess we need to once again "redirect" to another repo? |
Hey @MJTheOne, thanks for the elaborate report! Am I correct to say this only happens when used in combination with |
I must say, as elaborate as my answer was I did not consider just using In the first example I got the error, the second I did not. I could also have opened an issue at |
During
vendor/bin/phpstan
I have error. I have no idea how to solve this, because error file and line is same as first declaration of function.The text was updated successfully, but these errors were encountered: