mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-23 19:24:48 +01:00
* [SymfonyPhpConfig] Use Symplify package instead * [SymfonyPhpConfig] Drop forgotten custom-jobs Rectors * [CI] simplify set validation * from inline functions to Static class * cleanup * decouple rector.php to allow static analysis and coding standards
91 lines
4.1 KiB
PHP
91 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Rector\CakePHP\Rector\MethodCall\ArrayToFluentCallRector;
|
|
use Rector\CakePHP\ValueObject\ArrayToFluentCall;
|
|
use Rector\CakePHP\ValueObject\FactoryMethod;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
$services = $containerConfigurator->services();
|
|
|
|
$services->set(ArrayToFluentCallRector::class)
|
|
->call('configure', [[
|
|
ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => ValueObjectInliner::inline([
|
|
new ArrayToFluentCall('Cake\ORM\Association', [
|
|
'bindingKey' => 'setBindingKey',
|
|
'cascadeCallbacks' => 'setCascadeCallbacks',
|
|
'className' => 'setClassName',
|
|
'conditions' => 'setConditions',
|
|
'dependent' => 'setDependent',
|
|
'finder' => 'setFinder',
|
|
'foreignKey' => 'setForeignKey',
|
|
'joinType' => 'setJoinType',
|
|
'propertyName' => 'setProperty',
|
|
'sourceTable' => 'setSource',
|
|
'strategy' => 'setStrategy',
|
|
'targetTable' => 'setTarget',
|
|
# BelongsToMany and HasMany only
|
|
'saveStrategy' => 'setSaveStrategy',
|
|
'sort' => 'setSort',
|
|
# BelongsToMany only
|
|
'targetForeignKey' => 'setTargetForeignKey',
|
|
'through' => 'setThrough',
|
|
]),
|
|
new ArrayToFluentCall('Cake\ORM\Query', [
|
|
'fields' => 'select',
|
|
'conditions' => 'where',
|
|
'join' => 'join',
|
|
'order' => 'order',
|
|
'limit' => 'limit',
|
|
'offset' => 'offset',
|
|
'group' => 'group',
|
|
'having' => 'having',
|
|
'contain' => 'contain',
|
|
'page' => 'page',
|
|
]),
|
|
new ArrayToFluentCall('Cake\ORM\Association', [
|
|
'bindingKey' => 'setBindingKey',
|
|
'cascadeCallbacks' => 'setCascadeCallbacks',
|
|
'className' => 'setClassName',
|
|
'conditions' => 'setConditions',
|
|
'dependent' => 'setDependent',
|
|
'finder' => 'setFinder',
|
|
'foreignKey' => 'setForeignKey',
|
|
'joinType' => 'setJoinType',
|
|
'propertyName' => 'setProperty',
|
|
'sourceTable' => 'setSource',
|
|
'strategy' => 'setStrategy',
|
|
'targetTable' => 'setTarget',
|
|
# BelongsToMany and HasMany only
|
|
'saveStrategy' => 'setSaveStrategy',
|
|
'sort' => 'setSort',
|
|
# BelongsToMany only
|
|
'targetForeignKey' => 'setTargetForeignKey',
|
|
'through' => 'setThrough',
|
|
]),
|
|
new ArrayToFluentCall('Cake\ORM\Query', [
|
|
'fields' => 'select',
|
|
'conditions' => 'where',
|
|
'join' => 'join',
|
|
'order' => 'order',
|
|
'limit' => 'limit',
|
|
'offset' => 'offset',
|
|
'group' => 'group',
|
|
'having' => 'having',
|
|
'contain' => 'contain',
|
|
'page' => 'page',
|
|
]),
|
|
]),
|
|
ArrayToFluentCallRector::FACTORY_METHODS => ValueObjectInliner::inline([
|
|
new FactoryMethod('Cake\ORM\Table', 'belongsTo', 'Cake\ORM\Association', 2),
|
|
new FactoryMethod('Cake\ORM\Table', 'belongsToMany', 'Cake\ORM\Association', 2),
|
|
new FactoryMethod('Cake\ORM\Table', 'hasMany', 'Cake\ORM\Association', 2),
|
|
new FactoryMethod('Cake\ORM\Table', 'hasOne', 'Cake\ORM\Association', 2),
|
|
new FactoryMethod('Cake\ORM\Table', 'find', 'Cake\ORM\Query', 2),
|
|
]),
|
|
]]);
|
|
};
|