Turn dynamic docblock properties on class with no parents to explicit ones
-/**
- * @property SomeDependency $someDependency
- */
-#[\AllowDynamicProperties]
final class SomeClass
{
+ private SomeDependency $someDependency;
+
public function __construct()
{
$this->someDependency = new SomeDependency();
}
}
Configure your rector.php:
<?php
use Rector\CodeQuality\Rector\Class_\DynamicDocBlockPropertyToNativePropertyRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
DynamicDocBlockPropertyToNativePropertyRector::class,
]);