Catch method signature mismatches before they break your code. Perfect for API changes, refactoring validation, and ensuring compatibility across your codebase.
Quick Start
Jump straight in with these copy-paste prompts that catch compatibility issues instantly:
Check if the createUser method in UserController.ts matches what UserService.ts expects
Compare method signatures between old API in C:/api/v1/users.php and new version at C:/api/v2/users.php
Analyse method signature compatibility for PaymentProcessor class across these files
Prevent Breaking Changes
This catches the subtle parameter mismatches that cause runtime errors but pass syntax checks. Your future self will thank you!
What It Does
Ever changed a method signature and then spent hours tracking down all the places it broke? diff_method_signatures
is your early warning system for API compatibility issues.
It intelligently analyses method signatures across files to identify mismatches in:
- Parameter Types - Catches when you're passing strings to methods expecting numbers
- Parameter Count - Spots missing or extra parameters before runtime
- Calling Conventions - Identifies async/sync mismatches and callback patterns
- Return Types - Ensures method outputs match what callers expect
- Optional Parameters - Flags when required parameters become optional or vice versa
The analysis is particularly clever about framework-specific patterns - it understands React props, Laravel model relationships, and WordPress hook signatures.
Parameters
Configure the comparison to focus on exactly what you need to check:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callingFile |
string | Yes* | - |
Path to file containing the method calls Example:
"C:/src/UserController.ts" |
methodName |
string | No | - |
Specific method to check (focuses the analysis) Example:
"createUser" or "validatePayment" |
calledClass |
string | No | - |
Class containing the target method Example:
"UserService" or "PaymentGateway" |
projectPath |
string | Yes* | - |
Project root for comprehensive analysis Finds method definitions across your entire codebase
|
analysisType |
string | No | "comprehensive" |
Focus: "signature", "compatibility", "comprehensive" "signature" for detailed parameter analysis
|
analysisDepth |
string | No | "detailed" |
Analysis depth: "basic", "detailed", "comprehensive" Use "comprehensive" for critical API changes
|
*Either callingFile or projectPath is required - use both for the most thorough analysis
Real-World Examples
Here's how to catch compatibility issues in different scenarios:
API Version Migration
houtini-lm:diff_method_signatures with:
- callingFile: "C:/frontend/services/UserService.js"
- methodName: "createUser"
- calledClass: "UserAPI"
- projectPath: "C:/my-project"
- analysisDepth: "comprehensive"
React Component Refactoring
houtini-lm:diff_method_signatures with:
- callingFile: "C:/src/pages/Dashboard.tsx"
- methodName: "UserCard"
- projectPath: "C:/react-app"
- analysisType: "compatibility"
PHP Class Method Updates
houtini-lm:diff_method_signatures with:
- callingFile: "C:/app/Http/Controllers/UserController.php"
- methodName: "store"
- calledClass: "User"
- projectPath: "C:/laravel-project"
- analysisType: "comprehensive"
Cross-File Method Analysis
houtini-lm:diff_method_signatures with:
- files: ["C:/api/PaymentService.ts", "C:/frontend/PaymentHandler.js"]
- methodName: "processPayment"
- analysisDepth: "comprehensive"
What You Get Back
Get precise insights that help you fix compatibility issues before they cause problems:
🔍 Method Signature Comparison
- Side-by-side comparison of method signatures with clear highlighting
- Parameter mismatch identification - which parameters don't match
- Type incompatibility warnings with specific examples
- Missing or extra parameters flagged with suggestions
📍 Call-Site Analysis
- Exact locations where signature mismatches occur
- Line numbers and context for each problematic call
- Impact assessment - which calls will break
- Priority ranking based on usage frequency
🔧 Specific Fix Recommendations
- Corrected method signatures with exact parameter lists
- Migration scripts for large-scale changes
- Backward compatibility suggestions using overloads or defaults
- Testing recommendations to verify fixes work
⚠️ Risk Assessment
- Severity levels for each mismatch (critical, warning, info)
- Breaking change identification - what will stop working
- Runtime vs compile-time error predictions
- Rollback planning for safer deployments
Smart Context Understanding
The analysis understands framework patterns like React props, Laravel Eloquent relationships, and async/await patterns. It's not just syntax checking - it's intelligent compatibility analysis.
Perfect Use Cases
Here's when this function becomes your safety net:
🚀 API Version Updates
Before releasing API v2, check all client code against the new signatures. Spot the calls that need updating before your users do!
🔄 Large Refactoring Projects
When you're changing core methods used across dozens of files, this ensures you haven't missed any call sites or introduced type mismatches.
📦 Library Upgrades
Upgrading to a new version of React, Laravel, or any framework? Check your method calls against the new API signatures to avoid runtime surprises.
👥 Team Code Integration
When merging branches or integrating code from multiple developers, catch signature conflicts before the CI/CD pipeline does.
🔧 Interface Implementation
Ensuring your class methods properly implement interface requirements, with exactly the right parameter types and return values.
📱 Cross-Platform Compatibility
When sharing code between React Native and React Web, or between server and client, ensure method signatures stay compatible.
Best Practices
Get the most accurate compatibility analysis with these professional tips:
🎯 Be Specific About Method Names
When checking specific methods:
- Use the exact method name:
"createUser"
not"create"
- Include class context when methods have common names
- For overloaded methods, the analysis will show all variants
📁 Provide Project Context
Always include projectPath
for the most comprehensive analysis:
- Enables cross-file method discovery
- Understands your project's architecture patterns
- Finds method definitions in related files
- Catches indirect compatibility issues
⚡ Use the Right Analysis Depth
- "basic" - Quick parameter count and type check
- "detailed" - Include optional parameters and return types
- "comprehensive" - Full compatibility analysis with migration guidance
🔄 Integration with Development Workflow
Make signature checking part of your development process:
- Run before major refactoring sessions
- Check compatibility during code reviews
- Validate after library or framework upgrades
- Use as pre-deployment safety check
📊 Prioritise Fixes by Impact
Focus on the most critical mismatches first:
- Critical: Breaking changes that prevent compilation
- High: Runtime errors likely to occur in production
- Medium: Type warnings that could cause subtle bugs
- Low: Style or best practice improvements
Test After Changes
While this analysis catches most issues, always run your tests after making signature changes. Dynamic languages especially can have runtime surprises that static analysis might miss.
Troubleshooting
Resolve common issues and get better results:
Analysis finds too many false positives
Getting warnings about methods that you know are compatible.
- Be more specific with
methodName
andcalledClass
- Check that file paths are correct and accessible
- Use
analysisType: "signature"
for stricter checking - Ensure the analysis is looking at the right version of your files
Method definitions not found
Can't find the method definitions you're trying to compare against.
- Verify
projectPath
includes all relevant source files - Check file permissions and that paths are within allowed directories
- Increase
maxDepth
if methods are in deep directory structures - Ensure method names and class names are spelled correctly
TypeScript/JavaScript confusion
Analysis seems confused about type information or parameter types.
- Specify the language context in your prompt
- For TypeScript, mention if you're using strict mode
- Include framework context:
{"framework": "React", "typescript": true}
- Use "comprehensive" analysis for better type inference
Missing framework-specific patterns
Not getting insights about React props, Laravel models, or other framework patterns.
- Always include framework information in your analysis context
- Mention specific patterns:
"React hooks"
,"Laravel Eloquent"
- Use
analysisDepth: "comprehensive"
for framework-aware analysis - Include version numbers when relevant
Analysis takes too long on large projects
Method signature comparison is running slowly on large codebases.
- Be specific with
callingFile
instead of scanning entire project - Use
methodName
to focus on specific methods - Reduce
maxDepth
to limit file discovery scope - Try
analysisDepth: "basic"
for initial assessment