diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 200d1bfe..470fd5f2 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1037,7 +1037,7 @@ - + diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php index b52c42a3..8ce6007b 100644 --- a/src/Statements/CreateStatement.php +++ b/src/Statements/CreateStatement.php @@ -23,7 +23,7 @@ use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\SqlParser\TokensList; use PhpMyAdmin\SqlParser\TokenType; -use PhpMyAdmin\SqlParser\Utils\ForeignKeyData; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use function is_array; use function str_replace; @@ -778,7 +778,7 @@ public function parse(Parser $parser, TokensList $list): void } } - /** @return list */ + /** @return list */ public function getForeignKeys(): array { if (empty($this->fields) || (! is_array($this->fields)) || (! $this->options->has('TABLE'))) { @@ -801,7 +801,7 @@ public function getForeignKeys(): array $columns[] = $column['name']; } - $foreignKey = new ForeignKeyData(); + $foreignKey = new ForeignKey(); $foreignKey->constraint = $field->name; $foreignKey->indexList = $columns; diff --git a/src/Utils/ForeignKeyData.php b/src/Utils/ForeignKey.php similarity index 95% rename from src/Utils/ForeignKeyData.php rename to src/Utils/ForeignKey.php index 663dd6d9..54e294a0 100644 --- a/src/Utils/ForeignKeyData.php +++ b/src/Utils/ForeignKey.php @@ -4,7 +4,7 @@ namespace PhpMyAdmin\SqlParser\Utils; -final class ForeignKeyData +final class ForeignKey { /** * @param (int|string)[] $indexList diff --git a/tests/Utils/TableTest.php b/tests/Utils/TableTest.php index ba7d0511..c96f55b1 100644 --- a/tests/Utils/TableTest.php +++ b/tests/Utils/TableTest.php @@ -7,13 +7,13 @@ use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\CreateStatement; use PhpMyAdmin\SqlParser\Tests\TestCase; -use PhpMyAdmin\SqlParser\Utils\ForeignKeyData; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\SqlParser\Utils\Table; use PHPUnit\Framework\Attributes\DataProvider; class TableTest extends TestCase { - /** @param list $expected */ + /** @param list $expected */ #[DataProvider('getForeignKeysProvider')] public function testGetForeignKeys(string $query, array $expected): void { @@ -24,7 +24,7 @@ public function testGetForeignKeys(string $query, array $expected): void $this->assertEquals($expected, $result); } - /** @return list}> */ + /** @return list}> */ public static function getForeignKeysProvider(): array { return [ @@ -53,14 +53,14 @@ public static function getForeignKeysProvider(): array REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8', [ - new ForeignKeyData( + new ForeignKey( constraint: 'fk_payment_customer', indexList: ['customer_id'], refTableName: 'customer', refIndexList: ['customer_id'], onUpdate: 'CASCADE', ), - new ForeignKeyData( + new ForeignKey( constraint: 'fk_payment_rental', indexList: ['rental_id'], refTableName: 'rental', @@ -68,7 +68,7 @@ public static function getForeignKeysProvider(): array onDelete: 'SET_NULL', onUpdate: 'CASCADE', ), - new ForeignKeyData( + new ForeignKey( constraint: 'fk_payment_staff', indexList: ['staff_id'], refTableName: 'staff', @@ -103,7 +103,7 @@ public static function getForeignKeysProvider(): array CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8', [ - new ForeignKeyData( + new ForeignKey( constraint: 'fk_address_city', indexList: ['city_id'], refTableName: 'city',