Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to latest Rector 0.8.11 #264

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"php": "^8.1",
"cakephp/console": "5.x-dev",
"nette/utils": "^3.2",
"rector/rector": "0.17.13",
"rector/rector": "0.18.11",
"symfony/string": "^6.0"
},
"autoload": {
Expand All @@ -35,13 +35,6 @@
"rector/extension-installer": true
}
},
"extra": {
"rector": {
"includes": [
"config/rector/config.php"
]
}
},
"support": {
"source": "https://github.com/cakephp/upgrade"
}
Expand Down
16 changes: 0 additions & 16 deletions config/rector/config.php

This file was deleted.

1 change: 0 additions & 1 deletion config/rector/sets/cakephp-fluent-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(ArrayToFluentCallRector::class, [
ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => [
new ArrayToFluentCall('Cake\ORM\Association', [
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp30.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Rector\Renaming\Rector\Name\RenameClassRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
# @see https://github.com/cakephp/upgrade/tree/master/src/Shell/Task
$rectorConfig->rule(AppUsesStaticCallToUseStatementRector::class);

Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp34.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Rector\Visibility\ValueObject\ChangeMethodVisibility;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [
// source: https://book.cakephp.org/3.0/en/appendices/3-4-migration-guide.html
new PropertyFetchToMethodCall('Cake\Network\Request', 'params', 'getAttribute', null, ['params']),
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp35.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

# source: https://book.cakephp.org/3.0/en/appendices/3-5-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\Http\Client\CookieCollection' => 'Cake\Http\Cookie\CookieCollection',
'Cake\Console\ShellDispatcher' => 'Cake\Console\CommandRunner',
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp36.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
# source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
new MethodCallRename('Cake\ORM\Table', 'association', 'getAssociation'),
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp37.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

# source: https://book.cakephp.org/3.0/en/appendices/3-7-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
new MethodCallRename('Cake\Form\Form', 'errors', 'getErrors'),
new MethodCallRename('Cake\Validation\Validation', 'cc', 'creditCard'),
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp38.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# source: https://book.cakephp.org/3.0/en/appendices/3-8-migration-guide.html

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(
RenameMethodRector::class,
[new MethodCallRename('Cake\ORM\Entity', 'visibleProperties', 'getVisible')]
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp40.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# source: https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\Database\Type' => 'Cake\Database\TypeFactory',
'Cake\Console\ConsoleErrorHandler' => 'Cake\Error\ConsoleErrorHandler',
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp41.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\Renaming\ValueObject\MethodCallRename;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\Routing\Exception\RedirectException' => 'Cake\Http\Exception\RedirectException',
'Cake\Database\Expression\Comparison' => 'Cake\Database\Expression\ComparisonExpression',
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp42.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# source: https://book.cakephp.org/4/en/appendices/4-2-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\Core\Exception\Exception' => 'Cake\Core\Exception\CakeException',
'Cake\Database\Exception' => 'Cake\Database\Exception\DatabaseException',
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp43.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

# source: https://book.cakephp.org/4.next/en/appendices/4-3-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(
RenameMethodRector::class,
[new MethodCallRename('Cake\Controller\Component', 'shutdown', 'afterFilter')]
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp44.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# @see https://book.cakephp.org/4/en/appendices/4-4-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\TestSuite\ConsoleIntegrationTestTrait' => 'Cake\Console\TestSuite\ConsoleIntegrationTestTrait',
'Cake\TestSuite\Stub\ConsoleInput' => 'Cake\Console\TestSuite\StubConsoleInput',
Expand Down
1 change: 0 additions & 1 deletion config/rector/sets/cakephp45.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# @see https://book.cakephp.org/4/en/appendices/4-5-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\Datasource\Paging\Paginator' => 'Cake\Datasource\Paging\NumericPaginator',
'Cake\TestSuite\ContainerStubTrait' => 'Cake\Core\TestSuite\ContainerStubTrait',
Expand Down
2 changes: 0 additions & 2 deletions config/rector/sets/cakephp50.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

# @see https://book.cakephp.org/5/en/appendices/5-0-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');

$rectorConfig->ruleWithConfiguration(
OptionsArrayToNamedParametersRector::class,
[
Expand Down
2 changes: 0 additions & 2 deletions config/rector/sets/chronos3.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* @see https://github.com/cakephp/chronos/blob/3.x/docs/en/3-x-migration-guide.rst
*/
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../config.php');

$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
// Date
'Cake\Chronos\Date' => 'Cake\Chronos\ChronosDate',
Expand Down
2 changes: 1 addition & 1 deletion src/Rector/Rector/MethodCall/AddMethodCallArgsRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function refactor(Node $node): ?Node
continue;
}

$values = $methodCallRenameWithAddedArgument->getValues()[0];
$values = $methodCallRenameWithAddedArgument->getValues();
if ($node->args) {
$newArgs = [];
foreach ($node->args as $arg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Identifier;
use Cake\Upgrade\Rector\ValueObject\RenameMethodCallBasedOnParameter;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
Expand All @@ -30,6 +31,10 @@ final class RenameMethodCallBasedOnParameterRector extends AbstractRector implem
*/
private array $callsWithParamRenames = [];

public function __construct(private ValueResolver $valueResolver)
{
}

public function getRuleDefinition(): RuleDefinition
{
$configuration = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
use PhpParser\Node\Stmt;
use PhpParser\NodeTraverser;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
Expand All @@ -30,7 +32,9 @@
final class AppUsesStaticCallToUseStatementRector extends AbstractRector
{
public function __construct(
private ShortClassNameResolver $shortClassNameResolver
private ShortClassNameResolver $shortClassNameResolver,
private BetterNodeFinder $betterNodeFinder,
private ValueResolver $valueResolver
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(AddMethodCallArgsRector::class, [
new AddMethodCallArgs(SomeModelType::class, 'getAttribute', '2ndArg', 1, true),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(ArrayToFluentCallRector::class, [
ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => [
new ArrayToFluentCall(ConfigurableClass::class, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(ModalToGetSetRector::class, [

new ModalToGetSet(SomeModelType::class, 'config', null, null, 2, 'array'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(OptionsArrayToNamedParametersRector::class, [
new OptionsArrayToNamedParameters(ConfigurableClass::class, ['find']),
new OptionsArrayToNamedParameters(ConfigurableClass::class, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(
RemoveIntermediaryMethodRector::class,
[new RemoveIntermediaryMethod('getTableLocator', 'get', 'fetchTable')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(RemoveMethodCallRector::class, [
new RemoveMethodCall(SomeModelType::class, 'getAttribute'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->ruleWithConfiguration(RenameMethodCallBasedOnParameterRector::class, [
new RenameMethodCallBasedOnParameter(SomeModelType::class, 'getParam', 'paging', 'getAttribute'),
new RenameMethodCallBasedOnParameter(SomeModelType::class, 'withParam', 'paging', 'withAttribute'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->rule(AppUsesStaticCallToUseStatementRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/rector/config.php');

$rectorConfig->rule(ChangeSnakedFixtureNameToPascalRector::class);
};
Loading