[Php74] Add inlinePublic configurable for TypedPropertyRector#1745
[Php74] Add inlinePublic configurable for TypedPropertyRector#1745TomasVotruba merged 9 commits intomainfrom
Conversation
|
All checks have passed 🎉 @TomasVotruba it is ready for review. |
|
We're trying to separate PHP declaration rules (https://github.com/rectorphp/rector-src/blob/main/config/set/type-declaration-strict.php) and doblock rules (https://github.com/rectorphp/rector-src/blob/main/config/set/type-declaration.php). It would be better to have this as a separated rule in a docblock rules. Type declarations and docblocks have different priorities and can behave differently. The optional configuration of the rule can be easily overlooked. That's why it should extracted in a separated rule level. E.g. Could you add that one? |
|
I will try. |
|
@TomasVotruba as existing It seems will be duplicated/ambiguous while adding feature for protected and public, it seems we need to create 2 new rules instead:
The After that, remove the what do you think? |
|
@samsonasik It seems pretty complicated, you're right. Let's take this way then, with explicit option name: $services->set(TypedPropertyRector::class)
->configure([TypedPropertyRector::INLINE_PUBLIC => true]); |
0d37ab6 to
04ec582
Compare
|
@TomasVotruba ok, implemented with set |
|
All checks have passed 🎉 @TomasVotruba I think it is ready. |
|
Looks good, thank you 👍 |
@TomasVotruba this is alternative PR for #1744, which add a new config
isSafeTypedtoTypedPropertyRectorwhich default to true. If it set to false, with:It will change the following code:
to :
final class SimpleArray { - /** - * @var array - */ - private $foo; + private array $foo; - /** - * @var array - */ - protected $bar; + protected array $bar; - /** - * @var array - */ - public $baz; + public array $baz;Closes #1744
Closes rectorphp/rector#6872
Closes #1746