@@ -107,7 +107,13 @@ public function processNode(Node $node, Scope&NodeCallbackInvoker $scope): array
107107 return [];
108108 }
109109
110- [$ prototype , $ prototypeDeclaringClass , $ checkVisibility ] = $ prototypeData ;
110+ [
111+ $ prototype ,
112+ $ prototypeDeclaringClass ,
113+ $ checkVisibility ,
114+ $ inheritancePrototype ,
115+ $ inheritancePrototypeDeclaringClass ,
116+ ] = $ prototypeData ;
111117
112118 $ messages = [];
113119 if (
@@ -119,8 +125,8 @@ public function processNode(Node $node, Scope&NodeCallbackInvoker $scope): array
119125 'Method %s::%s() overrides method %s::%s() but is missing the #[\Override] attribute. ' ,
120126 $ method ->getDeclaringClass ()->getDisplayName (),
121127 $ method ->getName (),
122- $ prototypeDeclaringClass ->getDisplayName (true ),
123- $ prototype ->getName (),
128+ $ inheritancePrototypeDeclaringClass ->getDisplayName (true ),
129+ $ inheritancePrototype ->getName (),
124130 ))
125131 ->identifier ('method.missingOverride ' )
126132 ->fixNode ($ node ->getOriginalNode (), static function (Node \Stmt \ClassMethod $ method ) {
@@ -132,24 +138,24 @@ public function processNode(Node $node, Scope&NodeCallbackInvoker $scope): array
132138 })
133139 ->build ();
134140 }
135- if ($ prototype ->isFinalByKeyword ()->yes ()) {
141+ if ($ inheritancePrototype ->isFinalByKeyword ()->yes ()) {
136142 $ messages [] = RuleErrorBuilder::message (sprintf (
137143 'Method %s::%s() overrides final method %s::%s(). ' ,
138144 $ method ->getDeclaringClass ()->getDisplayName (),
139145 $ method ->getName (),
140- $ prototypeDeclaringClass ->getDisplayName (true ),
141- $ prototype ->getName (),
146+ $ inheritancePrototypeDeclaringClass ->getDisplayName (true ),
147+ $ inheritancePrototype ->getName (),
142148 ))
143149 ->nonIgnorable ()
144150 ->identifier ('method.parentMethodFinal ' )
145151 ->build ();
146- } elseif ($ prototype ->isFinal ()->yes ()) {
152+ } elseif ($ inheritancePrototype ->isFinal ()->yes ()) {
147153 $ messages [] = RuleErrorBuilder::message (sprintf (
148154 'Method %s::%s() overrides @final method %s::%s(). ' ,
149155 $ method ->getDeclaringClass ()->getDisplayName (),
150156 $ method ->getName (),
151- $ prototypeDeclaringClass ->getDisplayName (true ),
152- $ prototype ->getName (),
157+ $ inheritancePrototypeDeclaringClass ->getDisplayName (true ),
158+ $ inheritancePrototype ->getName (),
153159 ))->identifier ('method.parentMethodFinalByPhpDoc ' )
154160 ->build ();
155161 }
0 commit comments