Generating parameter, property & return types from phpdoc #9398
|
Hey, Thanks for the brilliant tool! As part of a bunch of refactoring, I was hoping to convert phpdoc tags into actual types - for example: class A {
/**
* @var string
*/
private $foo;
/**
* @param string $baz
* @return bool
*/
public function bar($baz) { }
}into: class A {
private string $foo;
public function bar(string $baz): bool { }
}However I'm struggling to find rules / sets that do this - the Just wondering if I'm missing something or if that's not currently implemented? |
Answered by
samsonasik
Oct 3, 2025
Replies: 1 comment 6 replies
|
Hey, thanks for good question. We've supported such conversion in the past, but it was breaking many codebases. Scalar docblock cannot be trusted, as it can contain anything. That's why we only support strict type declarations. |
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@acoulton I think you can create your own custom rule(s) for it :)