OneToOneAndIndexPositionalArgsToNamedArgsRector
Change positional arguments of #[ORM\OneToOne] and #[ORM\Index] in ORM 2.x order to named arguments, as their order changed in ORM 3.0
use Doctrine\ORM\Mapping as ORM;
-#[ORM\Index(['email'], null, 'email_idx')]
+#[ORM\Index(columns: ['email'], name: 'email_idx')]
class SomeEntity
{
- #[ORM\OneToOne('user', null, Profile::class)]
+ #[ORM\OneToOne(mappedBy: 'user', targetEntity: Profile::class)]
private $profile;
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\Orm30\Rector\Attribute\OneToOneAndIndexPositionalArgsToNamedArgsRector;
return RectorConfig::configure()
->withRules([
OneToOneAndIndexPositionalArgsToNamedArgsRector::class,
]);
PACKAGE:
doctrine/orm >=3.0 <5.0