Skip to content

Commit

Permalink
Add rector to GitHub CI and apply suggestions (#270)
Browse files Browse the repository at this point in the history
* Update rector/rector requirement from ^0.14 to ^0.17

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
  • Loading branch information
dependabot[bot] and vjik committed Jun 2, 2023
1 parent 37a0f7b commit 4b0ebcb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.0",
"rector/rector": "^0.14",
"rector/rector": "^0.17",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.3|^5.6",
Expand Down
9 changes: 7 additions & 2 deletions rector.php
Expand Up @@ -4,11 +4,11 @@

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->disableParallel();

$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
Expand All @@ -21,4 +21,9 @@
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);

$rectorConfig->skip([
ClosureToArrowFunctionRector::class,
AddDefaultValueForUndefinedVariableRector::class,
]);
};
2 changes: 0 additions & 2 deletions src/Schema.php
Expand Up @@ -411,8 +411,6 @@ protected function loadTableDefaultValues(string $tableName): array
* This method may be overridden by child classes to create a DBMS-specific column schema.
*
* @param string $name Name of the column.
*
* @return ColumnSchema
*/
protected function createColumnSchema(string $name): ColumnSchema
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Type/BigIntTest.php
Expand Up @@ -39,7 +39,7 @@ public function testCreateTableWithDefaultValue(): void

$this->assertSame('bigint', $tableSchema?->getColumn('Mybigint')->getDbType());
$this->assertSame('integer', $tableSchema?->getColumn('Mybigint')->getPhpType());
$this->assertSame(9223372036854775807, $tableSchema?->getColumn('Mybigint')->getDefaultValue());
$this->assertSame(9_223_372_036_854_775_807, $tableSchema?->getColumn('Mybigint')->getDefaultValue());

$db->createCommand()->dropTable('bigint_default')->execute();
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testDefaultValue(): void

$this->assertSame('bigint', $tableSchema?->getColumn('Mybigint')->getDbType());
$this->assertSame('integer', $tableSchema?->getColumn('Mybigint')->getPhpType());
$this->assertSame(9223372036854775807, $tableSchema?->getColumn('Mybigint')->getDefaultValue());
$this->assertSame(9_223_372_036_854_775_807, $tableSchema?->getColumn('Mybigint')->getDefaultValue());

$db->createCommand()->dropTable('bigint_default')->execute();
}
Expand Down
16 changes: 8 additions & 8 deletions tests/Type/IntTest.php
Expand Up @@ -39,7 +39,7 @@ public function testCreateTableWithDefaultValue(): void

$this->assertSame('int', $tableSchema?->getColumn('Myint')->getDbType());
$this->assertSame('integer', $tableSchema?->getColumn('Myint')->getPhpType());
$this->assertSame(2147483647, $tableSchema?->getColumn('Myint')->getDefaultValue());
$this->assertSame(2_147_483_647, $tableSchema?->getColumn('Myint')->getDefaultValue());

$db->createCommand()->dropTable('int_default')->execute();
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testDefaultValue(): void

$this->assertSame('int', $tableSchema?->getColumn('Myint')->getDbType());
$this->assertSame('integer', $tableSchema?->getColumn('Myint')->getPhpType());
$this->assertSame(2147483647, $tableSchema?->getColumn('Myint')->getDefaultValue());
$this->assertSame(2_147_483_647, $tableSchema?->getColumn('Myint')->getDefaultValue());

$db->createCommand()->dropTable('int_default')->execute();
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public function testMaxValue(): void

$db = $this->getConnection(true);
$command = $db->createCommand();
$command->insert('int', ['Myint1' => 2147483647, 'Myint2' => 0])->execute();
$command->insert('int', ['Myint1' => 2_147_483_647, 'Myint2' => 0])->execute();

$this->assertSame(
[
Expand All @@ -148,7 +148,7 @@ public function testMaxValue(): void
)->queryOne()
);

$command->insert('int', ['Myint1' => 2147483647, 'Myint2' => null])->execute();
$command->insert('int', ['Myint1' => 2_147_483_647, 'Myint2' => null])->execute();

$this->assertSame(
[
Expand Down Expand Up @@ -185,7 +185,7 @@ public function testMaxValueException(): void
'SQLSTATE[22003]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Arithmetic overflow'
);

$command->insert('int', ['Myint1' => 2147483648])->execute();
$command->insert('int', ['Myint1' => 2_147_483_648])->execute();
}

/**
Expand All @@ -203,7 +203,7 @@ public function testMinValue(): void

$db = $this->getConnection(true);
$command = $db->createCommand();
$command->insert('int', ['Myint1' => -2147483648, 'Myint2' => 0])->execute();
$command->insert('int', ['Myint1' => -2_147_483_648, 'Myint2' => 0])->execute();

$this->assertSame(
[
Expand All @@ -218,7 +218,7 @@ public function testMinValue(): void
)->queryOne()
);

$command->insert('int', ['Myint1' => -2147483648, 'Myint2' => null])->execute();
$command->insert('int', ['Myint1' => -2_147_483_648, 'Myint2' => null])->execute();

$this->assertSame(
[
Expand Down Expand Up @@ -255,7 +255,7 @@ public function testMinValueException(): void
'SQLSTATE[22003]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Arithmetic overflow'
);

$command->insert('int', ['Myint1' => -2147483649])->execute();
$command->insert('int', ['Myint1' => -2_147_483_649])->execute();
}

private function buildTable(): ConnectionInterface
Expand Down

0 comments on commit 4b0ebcb

Please sign in to comment.