mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Skip calling fake() when required parameters exist (Socialite compatibility) (#1746)
* Skip calling fake() on facades that require parameters (fix Socialite error) The ide-helper attempted to invoke Facade::fake() unconditionally, which breaks when a facade (such as Laravel Socialite) requires a mandatory parameter in its fake() method signature. This resulted in an ArgumentCountError during `php artisan ide-helper:generate`. This patch adds a ReflectionMethod check and skips calling fake() when required parameters are present, ensuring compatibility with Socialite and preserving expected behavior for facades that support parameterless faking. * Update Alias.php --------- Co-authored-by: Barry vd. Heuvel <[email protected]>
This commit is contained in:
co-authored by
Barry vd. Heuvel
parent
c95825a745
commit
2ac73f2953
+6
-2
@@ -248,16 +248,20 @@ class Alias
|
||||
return;
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionMethod($facade, 'fake');
|
||||
if ($reflection->getNumberOfRequiredParameters() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$real = $facade::getFacadeRoot();
|
||||
|
||||
try {
|
||||
$facade::fake();
|
||||
$fake = $facade::getFacadeRoot();
|
||||
|
||||
if ($fake !== $real) {
|
||||
$this->addClass(get_class($fake));
|
||||
}
|
||||
} catch (Throwable $throwable) {
|
||||
// Ignore error
|
||||
} finally {
|
||||
$facade::swap($real);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user