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