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? |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
@acoulton I think you can create your own custom rule(s) for it :)