mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 5edb023974a55b0efee74dd9fe92b314dd521f2c
5edb023974
fix config for configured rule
This commit is contained in:
parent
b2e06f0820
commit
ae1e3ab8ca
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -1305,6 +1305,7 @@ return array(
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdColumnAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdGeneratorAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdGeneratorAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\JoinColumnsTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/JoinColumnsTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ManyToOneAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ManyToOneAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OneToManyAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OneToManyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\YamlToAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/YamlToAnnotationTransformer.php',
|
||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -1524,6 +1524,7 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdColumnAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdGeneratorAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdGeneratorAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\JoinColumnsTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/JoinColumnsTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ManyToOneAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ManyToOneAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OneToManyAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OneToManyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\YamlToAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/YamlToAnnotationTransformer.php',
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -1679,12 +1679,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "95876d8299ccb731dd2bdce5bcf197a3ddf2cedb"
|
||||
"reference": "ad3117de1cad30f0eed35b2250eb501803d46d15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/95876d8299ccb731dd2bdce5bcf197a3ddf2cedb",
|
||||
"reference": "95876d8299ccb731dd2bdce5bcf197a3ddf2cedb",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/ad3117de1cad30f0eed35b2250eb501803d46d15",
|
||||
"reference": "ad3117de1cad30f0eed35b2250eb501803d46d15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1708,7 +1708,7 @@
|
||||
"tomasvotruba\/unused-public": "^0.3",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2024-02-11T23:31:10+00:00",
|
||||
"time": "2024-02-12T09:09:54+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -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 95876d8'), '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 8d1aab2'), '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 f091938'), '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 5a62f17'));
|
||||
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 ad3117d'), '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 8d1aab2'), '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 f091938'), '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 5a62f17'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransfor
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdColumnAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdGeneratorAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\JoinColumnsTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\ManyToOneAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\OneToManyAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\YamlToAnnotationTransformer;
|
||||
@ -37,6 +38,7 @@ return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->singleton(IdGeneratorAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(ManyToOneAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(OneToManyAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(JoinColumnsTransformer::class);
|
||||
$rectorConfig->when(YamlToAnnotationTransformer::class)->needs('$classAnnotationTransformers')->giveTagged(ClassAnnotationTransformerInterface::class);
|
||||
$rectorConfig->when(YamlToAnnotationTransformer::class)->needs('$propertyAnnotationTransformers')->giveTagged(PropertyAnnotationTransformerInterface::class);
|
||||
};
|
||||
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class JoinColumnsTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$manyToOnePropertyMapping = $entityMapping->matchManyToOnePropertyMapping($property);
|
||||
if (!\is_array($manyToOnePropertyMapping)) {
|
||||
return;
|
||||
}
|
||||
$joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null;
|
||||
if (!\is_array($joinColumns)) {
|
||||
return;
|
||||
}
|
||||
$joinColumnArrayItemNodes = [];
|
||||
foreach ($joinColumns as $columnName => $joinColumn) {
|
||||
$joinColumn = \array_merge(['name' => $columnName], $joinColumn);
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($joinColumn, ['name', 'referencedColumnName']);
|
||||
$joinColumnSpacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, 'Doctrine\\ORM\\Mapping\\JoinColumn');
|
||||
$joinColumnArrayItemNodes[] = new ArrayItemNode($joinColumnSpacelessPhpDocTagNode);
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($joinColumnArrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\JoinColumns';
|
||||
}
|
||||
}
|
@ -34,6 +34,10 @@ final class ArrayItemNodeFactory
|
||||
if (\in_array($fieldKey, self::EXTENSION_KEYS, \true)) {
|
||||
continue;
|
||||
}
|
||||
// special case for separate entity
|
||||
if ($fieldKey === 'joinColumns') {
|
||||
continue;
|
||||
}
|
||||
if (\is_array($fieldValue)) {
|
||||
$fieldValueArrayItemNodes = [];
|
||||
foreach ($fieldValue as $fieldSingleValue) {
|
||||
|
@ -5,10 +5,12 @@ namespace Rector\Doctrine\CodeQuality\Rector\Class_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Contract\DependencyInjection\RelatedConfigInterface;
|
||||
use Rector\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\YamlToAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\EntityMappingResolver;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Set\DoctrineSetList;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
@ -17,7 +19,7 @@ use RectorPrefix202402\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see \Rector\Doctrine\Tests\CodeQuality\Rector\Class_\YamlToAnnotationsDoctrineMappingRector\YamlToAnnotationsDoctrineMappingRectorTest
|
||||
*/
|
||||
final class YamlToAnnotationsDoctrineMappingRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
final class YamlToAnnotationsDoctrineMappingRector extends AbstractRector implements ConfigurableRectorInterface, RelatedConfigInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
@ -100,6 +102,10 @@ CODE_SAMPLE
|
||||
Assert::allFileExists($configuration);
|
||||
$this->yamlMappingDirectories = $configuration;
|
||||
}
|
||||
public static function getConfigFile() : string
|
||||
{
|
||||
return DoctrineSetList::YAML_TO_ANNOTATIONS;
|
||||
}
|
||||
private function findEntityMapping(Class_ $class) : ?EntityMapping
|
||||
{
|
||||
$className = $this->getName($class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user