From 16f685aa9ff3d0473ec9252cf514773c8ba74fb1 Mon Sep 17 00:00:00 2001 From: isaackaara Date: Wed, 4 Mar 2026 12:52:43 +0300 Subject: [PATCH] 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 --- src/Alias.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Alias.php b/src/Alias.php index 9a70ab0..a628361 100644 --- a/src/Alias.php +++ b/src/Alias.php @@ -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); } /**