kayw-geek / phpstan-type-trace
PublicSee the full type-inference chain of any value in PHPStan, not just a single snapshot.
This is a developer tool that acts like a detective for variable types in PHP code. When you're debugging why PHPStan thinks a variable has a 'mixed' type, this extension shows you the complete history of that variable — where it started, every time it was assigned a new value, and how its type changed through your code. It works in two ways: you can ask about any variable from the command line without changing your code, or you can add a special marker function directly in your code that shows the type chain when you run your normal analysis. The tool is designed to help developers understand complex type behavior, fix type-related bugs, and write better-typed PHP code.
How It Works
You're working on your PHP project and PHPStan keeps complaining about a variable being 'mixed' — you have no idea how it got that way.
You add this extension to your project — it installs automatically and becomes part of your type-checking workflow.
You can either ask about any variable from the command line, or drop a special marker right in your code where you want answers.
Ask about any variable at any line without changing your code — just run a simple command.
Drop traceType($myVar) into your code, run your normal analysis, and see the answer appear as a message.
You see exactly how your variable's type evolved: where it started, every change it went through, and why it ended up where it did.
You finally understand your code's type behavior and can confidently fix issues, add proper types, or explain to teammates what's happening.
Star Growth
Repurpose is a Pro feature
Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.
Unlock RepurposeSimilar repos coming soon.