Hello.
Great idea.
The PHP runtime already provides components that could serve as a foundation — e.g. php -l for syntax checking, reflection APIs, AST via php-ast, and insights from static analysis tools
like Psalm or PHPStan.
At the moment, PHP has several static analyzers.
But what would be really great is the ability to extend and combine
them — for example, having a separate module that determines the data
type of a variable. That component would be invaluable and could be
reused for various purposes, not just within LSP.
In JavaScript, the equivalent of such a “ring of power” was the Babel
project, which allowed manipulating the AST and writing custom
plugins. I think PHP could benefit greatly if such a tool were built
as a standard for AST analysis, allowing small plugins to be created
for it with minimal effort.
Ed