mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
fix: don't extend root's parent class for facade stubs in helper file (#1766)
Since #1674 (commit 09623f2), the generated IDE helper file adds an
`extends` declaration for Macroable classes to expose inherited methods.
However, the check to skip facades only excluded classes in the
`\Illuminate\Support\Facades` namespace, so third-party facades (e.g.
`Spatie\Menu\Laravel\Facades\Menu`) would incorrectly extend the
facade root's parent class.
This caused the generated stub to conflict with the real facade class:
namespace Spatie\Menu\Laravel\Facades {
class Menu extends \Spatie\Menu\Menu { // wrong!
The fix checks whether the extends class IS a Facade subclass (using
`is_subclass_of`) rather than comparing namespace strings. This
correctly excludes ALL facade classes (both Laravel and third-party)
while still allowing non-facade Macroable classes to extend their
parent.
Fixes #1724
This commit is contained in:
+1
-1
@@ -187,7 +187,7 @@ class Alias
|
||||
public function shouldExtendParentClass()
|
||||
{
|
||||
return $this->parentClass
|
||||
&& $this->getExtendsNamespace() !== '\\Illuminate\\Support\\Facades';
|
||||
&& !is_subclass_of($this->extends, \Illuminate\Support\Facades\Facade::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user