2525use ShipMonk \PHPStan \DeadCode \Graph \ClassMethodRef ;
2626use ShipMonk \PHPStan \DeadCode \Graph \ClassMethodUsage ;
2727use ShipMonk \PHPStan \DeadCode \Graph \CollectedUsage ;
28+ use ShipMonk \PHPStan \DeadCode \Graph \UsageOrigin ;
2829use ShipMonk \PHPStan \DeadCode \Graph \UsageOriginDetector ;
2930
3031/**
@@ -133,7 +134,7 @@ private function registerMethodCall(
133134 foreach ($ this ->getDeclaringTypesWithMethod ($ methodName , $ callerType , TrinaryLogic::createNo (), $ possibleDescendantCall ) as $ methodRef ) {
134135 $ this ->registerUsage (
135136 new ClassMethodUsage (
136- $ this ->usageOriginDetector ->detectOrigin ($ scope ),
137+ $ this ->usageOriginDetector ->detectOrigin ($ methodCall , $ scope ),
137138 $ methodRef ,
138139 ),
139140 $ methodCall ,
@@ -163,7 +164,7 @@ private function registerStaticCall(
163164 foreach ($ this ->getDeclaringTypesWithMethod ($ methodName , $ callerType , TrinaryLogic::createYes (), $ possibleDescendantCall ) as $ methodRef ) {
164165 $ this ->registerUsage (
165166 new ClassMethodUsage (
166- $ this ->usageOriginDetector ->detectOrigin ($ scope ),
167+ $ this ->usageOriginDetector ->detectOrigin ($ staticCall , $ scope ),
167168 $ methodRef ,
168169 ),
169170 $ staticCall ,
@@ -189,7 +190,7 @@ private function registerArrayCallable(
189190 foreach ($ this ->getDeclaringTypesWithMethod ($ methodName , $ caller , TrinaryLogic::createMaybe ()) as $ methodRef ) {
190191 $ this ->registerUsage (
191192 new ClassMethodUsage (
192- $ this ->usageOriginDetector ->detectOrigin ($ scope ),
193+ $ this ->usageOriginDetector ->detectOrigin ($ array , $ scope ),
193194 $ methodRef ,
194195 ),
195196 $ array ,
@@ -205,7 +206,7 @@ private function registerAttribute(Attribute $node, Scope $scope): void
205206 {
206207 $ this ->registerUsage (
207208 new ClassMethodUsage (
208- null ,
209+ UsageOrigin:: fromScope ( $ node , $ scope ) ,
209210 new ClassMethodRef ($ scope ->resolveName ($ node ->name ), '__construct ' , false ),
210211 ),
211212 $ node ,
@@ -221,7 +222,7 @@ private function registerClone(Clone_ $node, Scope $scope): void
221222 foreach ($ this ->getDeclaringTypesWithMethod ($ methodName , $ callerType , TrinaryLogic::createNo ()) as $ methodRef ) {
222223 $ this ->registerUsage (
223224 new ClassMethodUsage (
224- $ this ->usageOriginDetector ->detectOrigin ($ scope ),
225+ $ this ->usageOriginDetector ->detectOrigin ($ node , $ scope ),
225226 $ methodRef ,
226227 ),
227228 $ node ,
0 commit comments