@@ -91,8 +91,20 @@ impl Backend {
9191
9292 // Methods — filtered by static / instance, excluding magic methods
9393 for method in & target_class. methods {
94+ // `__construct` is meaningful to call explicitly via `::` or
95+ // `parent::` (e.g. `parent::__construct(...)` in a child class),
96+ // so we only suppress it for `->` access. All other magic
97+ // methods are always suppressed.
98+ let is_constructor = method. name . eq_ignore_ascii_case ( "__construct" ) ;
9499 if Self :: is_magic_method ( & method. name ) {
95- continue ;
100+ let allow = is_constructor
101+ && matches ! (
102+ access_kind,
103+ AccessKind :: DoubleColon | AccessKind :: ParentDoubleColon
104+ ) ;
105+ if !allow {
106+ continue ;
107+ }
96108 }
97109
98110 // parent:: excludes private members
@@ -104,7 +116,11 @@ impl Backend {
104116
105117 let include = match access_kind {
106118 AccessKind :: Arrow => !method. is_static ,
107- AccessKind :: DoubleColon => method. is_static ,
119+ // `::` normally shows only static methods, but `__construct`
120+ // is an exception — it's an instance method that is routinely
121+ // called via `parent::__construct(...)`, `self::__construct()`,
122+ // `static::__construct()`, or even `ClassName::__construct()`.
123+ AccessKind :: DoubleColon => method. is_static || is_constructor,
108124 // parent:: shows both static and non-static methods
109125 AccessKind :: ParentDoubleColon => true ,
110126 AccessKind :: Other => true ,
0 commit comments