Compare commits

...

2 Commits

Author SHA1 Message Date
Tomas Votruba 1c323223b2 Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-21 12:45:15 +00:00
Tomas Votruba 655c2aa498 Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-21 12:39:04 +00:00
7 changed files with 30 additions and 12 deletions

View File

@ -1679,12 +1679,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "b3da143634de79b24a266afc07401cfe75a2c49c"
"reference": "9e0a97b087071637e35eda5c7596704ee137a082"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/b3da143634de79b24a266afc07401cfe75a2c49c",
"reference": "b3da143634de79b24a266afc07401cfe75a2c49c",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/9e0a97b087071637e35eda5c7596704ee137a082",
"reference": "9e0a97b087071637e35eda5c7596704ee137a082",
"shasum": ""
},
"require": {
@ -1709,7 +1709,7 @@
"tomasvotruba\/unused-public": "^0.3",
"tracy\/tracy": "^2.10"
},
"time": "2024-03-22T00:11:46+00:00",
"time": "2024-04-21T12:41:39+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b8126e8'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 9e0a97b'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b8126e8'));
private function __construct()
{
}

View File

@ -37,11 +37,19 @@ final class TableClassAttributeTransformer implements ClassAttributeTransformerI
$args[] = AttributeFactory::createNamedArg(new String_($table), 'name');
}
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
$uniqueConstraints = $classMapping['uniqueConstraints'] ?? [];
foreach ($uniqueConstraints as $name => $uniqueConstraint) {
$uniqueConstraint = \array_merge(['name' => $name], $uniqueConstraint);
$args = $this->nodeFactory->createArgs($uniqueConstraint);
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::UNIQUE_CONSTRAINT, $args);
$this->addIndexes($classMapping['indexes'] ?? [], $class, MappingClass::INDEX);
$this->addIndexes($classMapping['uniqueConstraints'] ?? [], $class, MappingClass::UNIQUE_CONSTRAINT);
}
/**
* @param array<string, array<string, mixed>> $mapping
* @param MappingClass::* $attribute
*/
private function addIndexes(array $mapping, Class_ $class, string $attribute) : void
{
foreach ($mapping as $name => $values) {
$values = \array_merge(['name' => $name], $values);
$args = $this->nodeFactory->createArgs($values);
$class->attrGroups[] = AttributeFactory::createGroup($attribute, $args);
}
}
public function getClassName() : string

View File

@ -31,6 +31,12 @@ final class JoinColumnAttributeTransformer implements PropertyAttributeTransform
if (!\is_array($manyToOnePropertyMapping)) {
return;
}
$singleJoinColumn = $manyToOnePropertyMapping['joinColumn'] ?? null;
if (\is_array($singleJoinColumn)) {
$name = $singleJoinColumn['name'];
unset($singleJoinColumn['name']);
$manyToOnePropertyMapping['joinColumns'][$name] = $singleJoinColumn;
}
$joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null;
if (!\is_array($joinColumns)) {
return;

View File

@ -33,7 +33,7 @@ final class ManyToOneAttributeTransformer implements PropertyAttributeTransforme
return;
}
// handled by another mapper
unset($manyToOneMapping['joinColumns']);
unset($manyToOneMapping['joinColumn'], $manyToOneMapping['joinColumns']);
// non existing
unset($manyToOneMapping['nullable']);
$args = $this->nodeFactory->createArgs($manyToOneMapping);

View File

@ -53,6 +53,10 @@ final class MappingClass
* @var string
*/
public const GENERATED_VALUE = 'Doctrine\\ORM\\Mapping\\GeneratedValue';
/**
* @var string
*/
public const INDEX = 'Doctrine\\ORM\\Mapping\\Index';
/**
* @var string
*/