Skip to content
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
4 changes: 4 additions & 0 deletions config/rector/sets/cakephp53.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
use Cake\Upgrade\Rector\Rector\MethodCall\EntityIsEmptyRector;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;

# @see https://book.cakephp.org/5/en/appendices/5-3-migration-guide.html
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
new MethodCallRename('Cake\Database\Query', 'newExpr', 'expr'),
]);
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Cake\ORM\Query' => 'Cake\ORM\Query\SelectQuery',
]);
$rectorConfig->rule(EntityIsEmptyRector::class);
};
2 changes: 0 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0"?>
<ruleset name="CakePHP Upgrade">
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer"/>

<rule ref="CakePHP"/>

<exclude-pattern>tests/test_apps</exclude-pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Cake\ORM\Entity;
use Cake\ORM\Locator\LocatorAwareTrait;
use Cake\ORM\Query;

class SomeTest
{
Expand All @@ -18,4 +19,8 @@ public function testRenames(): void
$table = $this->fetchTable('Articles');
$expr = $table->find()->newExpr();
}

public function findSomething(Query $query, array $options): Query {
return $query;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Cake\ORM\Entity;
use Cake\ORM\Locator\LocatorAwareTrait;
use Cake\ORM\Query;

class SomeTest
{
Expand All @@ -18,4 +19,8 @@ public function testRenames(): void
$table = $this->fetchTable('Articles');
$expr = $table->find()->expr();
}

public function findSomething(\Cake\ORM\Query\SelectQuery $query, array $options): \Cake\ORM\Query\SelectQuery {
return $query;
}
}
Loading