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:
isaackaara
2026-03-04 10:52:43 +01:00
committed by GitHub
parent 392d5cfc80
commit 16f685aa9f
+1 -1
View File
@@ -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);
}
/**