vscode-phpactor
vscode-phpactor copied to clipboard
Assignment based type inference for class fields
It would be really helpful if type is inferred for variables based on assignment. In that case, because a value with a known type is assigned to $this->arg1, and because it has no explicit type declaration, its type should be known.

Of course @var comments should have the highest precedence.
I just noticed it workes in method scope:

So just needed for fields then.
Yes - this is constructor property type inference - it was supported for a couple of years but then with the language server it caused an infinite loop and I had to remove it :eyes:
That is really unfortunate. It's not that I can't live with it, it's just none of my services have type hints :-( Probably with 7.4 that won't be needed?
Yes, I would put it back it's a a question of time and it's not trivial...
I understand.
I'd rather have the refactorings implemented than this.