Skip to content

Commit 6c75bc5

Browse files
committed
Rename to ForeignKey
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent a7d7d8f commit 6c75bc5

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@
10371037
<code><![CDATA[$obj instanceof Parser]]></code>
10381038
</RedundantConditionGivenDocblockType>
10391039
</file>
1040-
<file src="src/Utils/ForeignKeyData.php">
1040+
<file src="src/Utils/ForeignKey.php">
10411041
<PossiblyUnusedProperty>
10421042
<code><![CDATA[$constraint]]></code>
10431043
<code><![CDATA[$indexList]]></code>

src/Statements/CreateStatement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use PhpMyAdmin\SqlParser\Token;
2424
use PhpMyAdmin\SqlParser\TokensList;
2525
use PhpMyAdmin\SqlParser\TokenType;
26-
use PhpMyAdmin\SqlParser\Utils\ForeignKeyData;
26+
use PhpMyAdmin\SqlParser\Utils\ForeignKey;
2727

2828
use function is_array;
2929
use function str_replace;
@@ -778,7 +778,7 @@ public function parse(Parser $parser, TokensList $list): void
778778
}
779779
}
780780

781-
/** @return list<ForeignKeyData> */
781+
/** @return list<ForeignKey> */
782782
public function getForeignKeys(): array
783783
{
784784
if (empty($this->fields) || (! is_array($this->fields)) || (! $this->options->has('TABLE'))) {
@@ -801,7 +801,7 @@ public function getForeignKeys(): array
801801
$columns[] = $column['name'];
802802
}
803803

804-
$foreignKey = new ForeignKeyData();
804+
$foreignKey = new ForeignKey();
805805
$foreignKey->constraint = $field->name;
806806
$foreignKey->indexList = $columns;
807807

src/Utils/ForeignKeyData.php renamed to src/Utils/ForeignKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace PhpMyAdmin\SqlParser\Utils;
66

7-
final class ForeignKeyData
7+
final class ForeignKey
88
{
99
/**
1010
* @param (int|string)[] $indexList

tests/Utils/TableTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
use PhpMyAdmin\SqlParser\Parser;
88
use PhpMyAdmin\SqlParser\Statements\CreateStatement;
99
use PhpMyAdmin\SqlParser\Tests\TestCase;
10-
use PhpMyAdmin\SqlParser\Utils\ForeignKeyData;
10+
use PhpMyAdmin\SqlParser\Utils\ForeignKey;
1111
use PhpMyAdmin\SqlParser\Utils\Table;
1212
use PHPUnit\Framework\Attributes\DataProvider;
1313

1414
class TableTest extends TestCase
1515
{
16-
/** @param list<ForeignKeyData> $expected */
16+
/** @param list<ForeignKey> $expected */
1717
#[DataProvider('getForeignKeysProvider')]
1818
public function testGetForeignKeys(string $query, array $expected): void
1919
{
@@ -24,7 +24,7 @@ public function testGetForeignKeys(string $query, array $expected): void
2424
$this->assertEquals($expected, $result);
2525
}
2626

27-
/** @return list<array{string, list<ForeignKeyData>}> */
27+
/** @return list<array{string, list<ForeignKey>}> */
2828
public static function getForeignKeysProvider(): array
2929
{
3030
return [
@@ -53,22 +53,22 @@ public static function getForeignKeysProvider(): array
5353
REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
5454
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8',
5555
[
56-
new ForeignKeyData(
56+
new ForeignKey(
5757
constraint: 'fk_payment_customer',
5858
indexList: ['customer_id'],
5959
refTableName: 'customer',
6060
refIndexList: ['customer_id'],
6161
onUpdate: 'CASCADE',
6262
),
63-
new ForeignKeyData(
63+
new ForeignKey(
6464
constraint: 'fk_payment_rental',
6565
indexList: ['rental_id'],
6666
refTableName: 'rental',
6767
refIndexList: ['rental_id'],
6868
onDelete: 'SET_NULL',
6969
onUpdate: 'CASCADE',
7070
),
71-
new ForeignKeyData(
71+
new ForeignKey(
7272
constraint: 'fk_payment_staff',
7373
indexList: ['staff_id'],
7474
refTableName: 'staff',
@@ -103,7 +103,7 @@ public static function getForeignKeysProvider(): array
103103
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
104104
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8',
105105
[
106-
new ForeignKeyData(
106+
new ForeignKey(
107107
constraint: 'fk_address_city',
108108
indexList: ['city_id'],
109109
refTableName: 'city',

0 commit comments

Comments
 (0)