( ref: UnresolvedRef, context: ResolutionContext, )
| 893 | * edge rather than a wrong one. Shared by the `::`-receiver languages (PHP, Rust). |
| 894 | */ |
| 895 | export function matchScopedCallChain( |
| 896 | ref: UnresolvedRef, |
| 897 | context: ResolutionContext, |
| 898 | ): ResolvedRef | null { |
| 899 | const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/); |
| 900 | if (!m || !m[1] || !m[2]) return null; |
| 901 | const inner = m[1]; |
| 902 | const method = m[2]; |
| 903 | if (!inner.includes('::')) return null; // only static-factory (`Cls::method`) chains |
| 904 | const factoryClass = inner.slice(0, inner.lastIndexOf('::')); |
| 905 | const ret = lookupCalleeReturnType(inner, ref, context); |
| 906 | if (!ret) return null; |
| 907 | // `self` (the extractor's marker for self/static/$this) → the factory's class. |
| 908 | const resolvedClass = ret === 'self' ? factoryClass : ret; |
| 909 | return resolveMethodOnType(resolvedClass, method, ref, context, 0.85, 'instance-method'); |
| 910 | } |
| 911 | |
| 912 | /** |
| 913 | * Languages where an unprefixed capitalized call `Foo(args)` constructs the |
no test coverage detected