diff --git a/composer.lock b/composer.lock index f201ab2de3..59024b0332 100644 --- a/composer.lock +++ b/composer.lock @@ -454,12 +454,12 @@ "source": { "type": "git", "url": "https://github.com/phpmyadmin/sql-parser.git", - "reference": "1e1693e5f38bed200b51ce3a338eb1a58f7c6321" + "reference": "98b704ce46e0443209b1762d679020e0a17c4f05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/1e1693e5f38bed200b51ce3a338eb1a58f7c6321", - "reference": "1e1693e5f38bed200b51ce3a338eb1a58f7c6321", + "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/98b704ce46e0443209b1762d679020e0a17c4f05", + "reference": "98b704ce46e0443209b1762d679020e0a17c4f05", "shasum": "" }, "require": { @@ -538,7 +538,7 @@ "type": "other" } ], - "time": "2024-09-19T23:37:46+00:00" + "time": "2024-09-24T16:33:57+00:00" }, { "name": "psr/cache", @@ -1041,16 +1041,16 @@ }, { "name": "symfony/cache", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "b61e464d7687bb7e8f677d5031c632bf3820df18" + "reference": "86e5296b10e4dec8c8441056ca606aedb8a3be0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/b61e464d7687bb7e8f677d5031c632bf3820df18", - "reference": "b61e464d7687bb7e8f677d5031c632bf3820df18", + "url": "https://api.github.com/repos/symfony/cache/zipball/86e5296b10e4dec8c8441056ca606aedb8a3be0a", + "reference": "86e5296b10e4dec8c8441056ca606aedb8a3be0a", "shasum": "" }, "require": { @@ -1118,7 +1118,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.1.4" + "source": "https://github.com/symfony/cache/tree/v7.1.5" }, "funding": [ { @@ -1134,7 +1134,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:59:40+00:00" + "time": "2024-09-17T09:16:35+00:00" }, { "name": "symfony/cache-contracts", @@ -1289,16 +1289,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "5320e0bc2c9e2d7450bb4091e497a305a68b28ed" + "reference": "38465f925ec4e0707b090e9147c65869837d639d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5320e0bc2c9e2d7450bb4091e497a305a68b28ed", - "reference": "5320e0bc2c9e2d7450bb4091e497a305a68b28ed", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/38465f925ec4e0707b090e9147c65869837d639d", + "reference": "38465f925ec4e0707b090e9147c65869837d639d", "shasum": "" }, "require": { @@ -1349,7 +1349,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.1.4" + "source": "https://github.com/symfony/dependency-injection/tree/v7.1.5" }, "funding": [ { @@ -1365,7 +1365,7 @@ "type": "tidelift" } ], - "time": "2024-08-29T08:16:25+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1500,16 +1500,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.2", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" + "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/61fe0566189bf32e8cfee78335d8776f64a66f5a", + "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a", "shasum": "" }, "require": { @@ -1546,7 +1546,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.2" + "source": "https://github.com/symfony/filesystem/tree/v7.1.5" }, "funding": [ { @@ -1562,7 +1562,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-09-17T09:16:35+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4395,16 +4395,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.1", + "version": "1.31.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e" + "reference": "249f15fb843bf240cf058372dad29e100cee6c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/249f15fb843bf240cf058372dad29e100cee6c17", + "reference": "249f15fb843bf240cf058372dad29e100cee6c17", "shasum": "" }, "require": { @@ -4436,9 +4436,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.31.0" }, - "time": "2024-09-07T20:13:05+00:00" + "time": "2024-09-22T11:32:18+00:00" }, { "name": "phpstan/phpstan", @@ -5407,12 +5407,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "4b6b927472278272e2411f4341dba95d96c8c7d7" + "reference": "4d2e39c44028ba729fe50efdf731d3d2ede4046b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4b6b927472278272e2411f4341dba95d96c8c7d7", - "reference": "4b6b927472278272e2411f4341dba95d96c8c7d7", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4d2e39c44028ba729fe50efdf731d3d2ede4046b", + "reference": "4d2e39c44028ba729fe50efdf731d3d2ede4046b", "shasum": "" }, "conflict": { @@ -5550,9 +5550,9 @@ "dolibarr/dolibarr": "<19.0.2", "dompdf/dompdf": "<2.0.4", "doublethreedigital/guest-entries": "<3.1.2", - "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2|==11.9999999.9999999.9999999-dev", - "drupal/core-recommended": "==11.9999999.9999999.9999999-dev", - "drupal/drupal": ">=5,<5.11|>=6,<6.38|>=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4|==11.9999999.9999999.9999999-dev", + "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<=11.0.4", + "drupal/core-recommended": ">=8,<=11.0.4", + "drupal/drupal": ">=5,<5.11|>=6,<6.38|>=7,<7.80|>=8,<=11.0.4", "duncanmcclean/guest-entries": "<3.1.2", "dweeves/magmi": "<=0.7.24", "ec-cube/ec-cube": "<2.4.4|>=2.11,<=2.17.1|>=3,<=3.0.18.0-patch4|>=4,<=4.1.2", @@ -6224,7 +6224,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T17:04:43+00:00" + "time": "2024-09-23T20:04:53+00:00" }, { "name": "sebastian/cli-parser", @@ -7551,16 +7551,16 @@ }, { "name": "symfony/console", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" + "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee", + "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee", "shasum": "" }, "require": { @@ -7624,7 +7624,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.4" + "source": "https://github.com/symfony/console/tree/v7.1.5" }, "funding": [ { @@ -7640,7 +7640,7 @@ "type": "tidelift" } ], - "time": "2024-08-15T22:48:53+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -7882,16 +7882,16 @@ }, { "name": "symfony/process", - "version": "v7.1.3", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" + "reference": "5c03ee6369281177f07f7c68252a280beccba847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", - "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847", + "reference": "5c03ee6369281177f07f7c68252a280beccba847", "shasum": "" }, "require": { @@ -7923,7 +7923,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.3" + "source": "https://github.com/symfony/process/tree/v7.1.5" }, "funding": [ { @@ -7939,20 +7939,20 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:44:47+00:00" + "time": "2024-09-19T21:48:23+00:00" }, { "name": "symfony/string", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" + "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306", + "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306", "shasum": "" }, "require": { @@ -8010,7 +8010,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.4" + "source": "https://github.com/symfony/string/tree/v7.1.5" }, "funding": [ { @@ -8026,20 +8026,20 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:59:40+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "symfony/uid", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "82177535395109075cdb45a70533aa3d7a521cdf" + "reference": "8c7bb8acb933964055215d89f9a9871df0239317" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/82177535395109075cdb45a70533aa3d7a521cdf", - "reference": "82177535395109075cdb45a70533aa3d7a521cdf", + "url": "https://api.github.com/repos/symfony/uid/zipball/8c7bb8acb933964055215d89f9a9871df0239317", + "reference": "8c7bb8acb933964055215d89f9a9871df0239317", "shasum": "" }, "require": { @@ -8084,7 +8084,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v7.1.4" + "source": "https://github.com/symfony/uid/tree/v7.1.5" }, "funding": [ { @@ -8100,7 +8100,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:59:40+00:00" + "time": "2024-09-17T09:16:35+00:00" }, { "name": "tecnickcom/tcpdf", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5b4c9807b2..aa1a473007 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1055,41 +1055,6 @@ parameters: count: 1 path: src/ConfigStorage/Relation.php - - - message: "#^Cannot access offset 'constraint' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'on_delete' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'on_update' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - message: "#^Cannot access offset 'table_name' on mixed\\.$#" count: 1 @@ -1100,11 +1065,6 @@ parameters: count: 1 path: src/ConfigStorage/Relation.php - - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - message: "#^Cannot cast mixed to string\\.$#" count: 1 @@ -1325,11 +1285,6 @@ parameters: count: 1 path: src/ConfigStorage/Relation.php - - - message: "#^Parameter \\#2 \\$haystack of function array_search expects array, mixed given\\.$#" - count: 1 - path: src/ConfigStorage/Relation.php - - message: "#^Parameter \\#2 \\$table of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getDisplayField\\(\\) expects string, mixed given\\.$#" count: 1 @@ -4280,36 +4235,6 @@ parameters: count: 1 path: src/Controllers/Table/Partition/RepairController.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - - - message: "#^Cannot access offset 'foreign_db' on mixed\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - - - message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Controllers/Table/RelationController.php - - message: "#^Parameter \\#1 \\$dbName of method PhpMyAdmin\\\\DatabaseInterface\\:\\:getTable\\(\\) expects string, mixed given\\.$#" count: 1 @@ -4386,7 +4311,7 @@ parameters: path: src/Controllers/Table/RelationController.php - - message: "#^Parameter \\#7 \\$existrelForeign of method PhpMyAdmin\\\\Table\\\\Table\\:\\:updateForeignKeys\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#7 \\$existrelForeign of method PhpMyAdmin\\\\Table\\\\Table\\:\\:updateForeignKeys\\(\\) expects array\\, array given\\.$#" count: 1 path: src/Controllers/Table/RelationController.php @@ -5722,52 +5647,12 @@ parameters: - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 3 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'constraint' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'foreign_db' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Database/Designer/Common.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" count: 1 path: src/Database/Designer/Common.php - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 5 + count: 4 path: src/Database/Designer/Common.php - @@ -5820,9 +5705,19 @@ parameters: count: 2 path: src/Database/Designer/Common.php + - + message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, int\\|string given\\.$#" + count: 1 + path: src/Database/Designer/Common.php + - message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, mixed given\\.$#" - count: 4 + count: 1 + path: src/Database/Designer/Common.php + + - + message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#" + count: 1 path: src/Database/Designer/Common.php - @@ -6337,7 +6232,7 @@ parameters: - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 6 + count: 4 path: src/Display/Results.php - @@ -6350,21 +6245,6 @@ parameters: count: 6 path: src/Display/Results.php - - - message: "#^Cannot access offset 'foreign_db' on mixed\\.$#" - count: 2 - path: src/Display/Results.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Display/Results.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 2 - path: src/Display/Results.php - - message: "#^Cannot access offset 'geoOption' on mixed\\.$#" count: 8 @@ -6375,11 +6255,6 @@ parameters: count: 8 path: src/Display/Results.php - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Display/Results.php - - message: "#^Cannot access offset 'max_rows' on mixed\\.$#" count: 18 @@ -6405,21 +6280,6 @@ parameters: count: 6 path: src/Display/Results.php - - - message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#" - count: 2 - path: src/Display/Results.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Display/Results.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 - path: src/Display/Results.php - - message: "#^Cannot access offset 'relational_display' on mixed\\.$#" count: 7 @@ -6445,11 +6305,6 @@ parameters: count: 2 path: src/Display/Results.php - - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 1 - path: src/Display/Results.php - - message: "#^Cannot access offset non\\-falsy\\-string on mixed\\.$#" count: 4 @@ -6572,7 +6427,7 @@ parameters: - message: "#^Parameter \\#1 \\$db of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getDisplayField\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Display/Results.php - @@ -6602,7 +6457,12 @@ parameters: - message: "#^Parameter \\#1 \\$table of class PhpMyAdmin\\\\Display\\\\ForeignKeyRelatedTable constructor expects string, mixed given\\.$#" - count: 2 + count: 1 + path: src/Display/Results.php + + - + message: "#^Parameter \\#1 \\$table of class PhpMyAdmin\\\\Display\\\\ForeignKeyRelatedTable constructor expects string, string\\|null given\\.$#" + count: 1 path: src/Display/Results.php - @@ -6617,7 +6477,7 @@ parameters: - message: "#^Parameter \\#2 \\$field of class PhpMyAdmin\\\\Display\\\\ForeignKeyRelatedTable constructor expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Display/Results.php - @@ -6652,7 +6512,12 @@ parameters: - message: "#^Parameter \\#2 \\$table of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getDisplayField\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 + path: src/Display/Results.php + + - + message: "#^Parameter \\#2 \\$table of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getDisplayField\\(\\) expects string, string\\|null given\\.$#" + count: 1 path: src/Display/Results.php - @@ -6667,7 +6532,7 @@ parameters: - message: "#^Parameter \\#4 \\$database of class PhpMyAdmin\\\\Display\\\\ForeignKeyRelatedTable constructor expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Display/Results.php - @@ -8925,21 +8790,6 @@ parameters: count: 4 path: src/Normalization.php - - - message: "#^Cannot access offset 'foreign_db' on mixed\\.$#" - count: 4 - path: src/Operations.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 3 - path: src/Operations.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 4 - path: src/Operations.php - - message: "#^Cannot access offset 0 on mixed\\.$#" count: 6 @@ -9890,11 +9740,6 @@ parameters: count: 1 path: src/Plugins/Export/ExportPhparray.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/Plugins/Export/ExportSql.php - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" count: 2 @@ -9920,31 +9765,6 @@ parameters: count: 2 path: src/Plugins/Export/ExportSql.php - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/ExportSql.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/ExportSql.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/ExportSql.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/ExportSql.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/ExportSql.php - - message: "#^Cannot access offset 'single_table' on mixed\\.$#" count: 1 @@ -9961,8 +9781,8 @@ parameters: path: src/Plugins/Export/ExportSql.php - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 2 + message: "#^Cannot access offset int\\|string on mixed\\.$#" + count: 1 path: src/Plugins/Export/ExportSql.php - @@ -10067,7 +9887,7 @@ parameters: - message: "#^Parameter \\#1 \\$identifier of static method PhpMyAdmin\\\\Util\\:\\:backquoteCompat\\(\\) expects string\\|Stringable\\|null, mixed given\\.$#" - count: 19 + count: 17 path: src/Plugins/Export/ExportSql.php - @@ -10255,16 +10075,6 @@ parameters: count: 1 path: src/Plugins/Export/Helpers/Pdf.php - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/Helpers/Pdf.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Export/Helpers/Pdf.php - - message: "#^Cannot access offset 'olm' on mixed\\.$#" count: 2 @@ -10790,41 +10600,6 @@ parameters: count: 1 path: src/Plugins/Import/Upload/UploadSession.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - message: "#^Cannot cast mixed to string\\.$#" count: 2 @@ -10836,13 +10611,13 @@ parameters: path: src/Plugins/Schema/Dia/DiaRelationSchema.php - - message: "#^Parameter \\#2 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Dia\\\\DiaRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Dia\\\\DiaRelationSchema\\:\\:addRelation\\(\\) expects string, int\\|string given\\.$#" count: 1 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - message: "#^Parameter \\#4 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Dia\\\\DiaRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Dia/DiaRelationSchema.php - @@ -10865,41 +10640,6 @@ parameters: count: 1 path: src/Plugins/Schema/Dia/TableStatsDia.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - message: "#^Cannot cast mixed to string\\.$#" count: 1 @@ -10911,13 +10651,13 @@ parameters: path: src/Plugins/Schema/Eps/EpsRelationSchema.php - - message: "#^Parameter \\#4 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Eps\\\\EpsRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#4 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Eps\\\\EpsRelationSchema\\:\\:addRelation\\(\\) expects string, int\\|string given\\.$#" count: 1 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - message: "#^Parameter \\#6 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Eps\\\\EpsRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Eps/EpsRelationSchema.php - @@ -10990,11 +10730,6 @@ parameters: count: 1 path: src/Plugins/Schema/Pdf/Pdf.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - message: "#^Call to method TCPDF\\:\\:Line\\(\\) with incorrect case\\: line$#" count: 2 @@ -11005,34 +10740,9 @@ parameters: count: 10 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 14 + count: 13 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - @@ -11086,7 +10796,7 @@ parameters: path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - - message: "#^Parameter \\#2 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Pdf\\\\PdfRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Pdf\\\\PdfRelationSchema\\:\\:addRelation\\(\\) expects string, int\\|string given\\.$#" count: 1 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -11117,7 +10827,7 @@ parameters: - message: "#^Parameter \\#4 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Pdf\\\\PdfRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Pdf/PdfRelationSchema.php - @@ -11185,54 +10895,19 @@ parameters: count: 7 path: src/Plugins/Schema/Svg/RelationStatsSvg.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 2 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_field' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset 'foreign_table' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - - - message: "#^Cannot access offset mixed on mixed\\.$#" - count: 1 - path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - message: "#^Parameter \\#4 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, \\(int\\|string\\) given\\.$#" count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - - message: "#^Parameter \\#4 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#4 \\$masterField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, int\\|string given\\.$#" count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - message: "#^Parameter \\#6 \\$foreignField of method PhpMyAdmin\\\\Plugins\\\\Schema\\\\Svg\\\\SvgRelationSchema\\:\\:addRelation\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 path: src/Plugins/Schema/Svg/SvgRelationSchema.php - @@ -13060,11 +12735,6 @@ parameters: count: 2 path: src/Table/Table.php - - - message: "#^Cannot access offset 'constraint' on mixed\\.$#" - count: 3 - path: src/Table/Table.php - - message: "#^Cannot access offset 'foreign_db' on mixed\\.$#" count: 1 @@ -13080,36 +12750,6 @@ parameters: count: 1 path: src/Table/Table.php - - - message: "#^Cannot access offset 'index_list' on mixed\\.$#" - count: 1 - path: src/Table/Table.php - - - - message: "#^Cannot access offset 'on_delete' on mixed\\.$#" - count: 2 - path: src/Table/Table.php - - - - message: "#^Cannot access offset 'on_update' on mixed\\.$#" - count: 2 - path: src/Table/Table.php - - - - message: "#^Cannot access offset 'ref_db_name' on mixed\\.$#" - count: 2 - path: src/Table/Table.php - - - - message: "#^Cannot access offset 'ref_index_list' on mixed\\.$#" - count: 2 - path: src/Table/Table.php - - - - message: "#^Cannot access offset 'ref_table_name' on mixed\\.$#" - count: 2 - path: src/Table/Table.php - - message: "#^Cannot access offset 'table_uiprefs' on mixed\\.$#" count: 3 @@ -13217,7 +12857,7 @@ parameters: - message: "#^Parameter \\#1 \\$identifier of static method PhpMyAdmin\\\\Util\\:\\:backquote\\(\\) expects string\\|Stringable\\|null, mixed given\\.$#" - count: 6 + count: 5 path: src/Table/Table.php - @@ -13267,22 +12907,32 @@ parameters: - message: "#^Parameter \\#3 \\$foreignDb of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 + path: src/Table/Table.php + + - + message: "#^Parameter \\#3 \\$foreignDb of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects string, string\\|null given\\.$#" + count: 1 path: src/Table/Table.php - message: "#^Parameter \\#4 \\$foreignTable of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects string, mixed given\\.$#" - count: 2 + count: 1 + path: src/Table/Table.php + + - + message: "#^Parameter \\#4 \\$foreignTable of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects string, string\\|null given\\.$#" + count: 1 path: src/Table/Table.php - message: "#^Parameter \\#5 \\$foreignField of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects array, mixed given\\.$#" - count: 2 + count: 1 path: src/Table/Table.php - message: "#^Parameter \\#6 \\$name of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getSQLToCreateForeignKey\\(\\) expects string\\|null, mixed given\\.$#" - count: 2 + count: 1 path: src/Table/Table.php - diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f11d9f7811..3e558db20d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -713,7 +713,6 @@ - @@ -723,21 +722,12 @@ - - - - - - - - - @@ -747,16 +737,9 @@ - - - - - - - @@ -3677,22 +3660,11 @@ - + - - - - - field]['foreign_db']]]> - field]['foreign_field']]]> - field]['foreign_table']]]> - - - - - + @@ -4650,42 +4622,19 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -4693,6 +4642,7 @@ + @@ -4713,12 +4663,16 @@ + constraint]]> + + refTableName]]> + @@ -5271,11 +5225,6 @@ alias]]> table]]> - - - - - @@ -5336,13 +5285,6 @@ - - - - - - - @@ -5352,11 +5294,6 @@ - - - - - @@ -5390,8 +5327,6 @@ - - @@ -5435,13 +5370,9 @@ - name]]> - - - @@ -5482,6 +5413,7 @@ + refTableName]]> parser->list]]> parser->list]]> parser->list]]> @@ -7244,17 +7176,6 @@ - - - - - - - - - - - @@ -7291,7 +7212,6 @@ - @@ -8217,8 +8137,6 @@ - - @@ -8230,17 +8148,7 @@ - - - - - - - - - - @@ -8254,14 +8162,10 @@ - name]]> references->table->table]]> - - - name->database]]> @@ -9149,34 +9053,14 @@ - - - - - - - - - - - - - - - - - - - + - - - + @@ -9225,34 +9109,14 @@ - - - - - - - - - - - - - - - - - - - + - - - + @@ -9389,11 +9253,7 @@ - - - - @@ -9408,14 +9268,6 @@ - - - - - - - - pdf->customLinks['RT']['-']]]> pdf->customLinks['doc'][$foreigner['foreign_table']]]]> pdf->customLinks['doc'][$table]]]> @@ -9436,7 +9288,6 @@ - pdf->customLinks['RT'][$table]]]> pdf->customLinks['doc'][$foreigner['foreign_table']]]]> pdf->customLinks['doc'][$foreigner['foreign_table']]]]> @@ -9447,12 +9298,8 @@ - - - - @@ -9468,6 +9315,7 @@ + @@ -9662,34 +9510,14 @@ - - - - - - - - - - - - - - - - - - - + - - - + tables[$table]->width = &$this->tablewidth]]> @@ -11133,11 +10961,6 @@ - - - - - @@ -11172,20 +10995,6 @@ - - - - - - - - - - - - - - @@ -11216,18 +11025,11 @@ - - - - - - - @@ -11238,12 +11040,9 @@ - - - @@ -11280,36 +11079,20 @@ - - - + refDbName]]> + refTableName]]> - - - - - - - - - - - - - - - - - + onDelete)]]> + onUpdate)]]> uiprefs =& $_SESSION['tmpval']['table_uiprefs'][$serverId][$this->dbName][$this->name]]]> diff --git a/resources/templates/table/relation/foreign_key_row.twig b/resources/templates/table/relation/foreign_key_row.twig index c343804468..f53b356cbd 100644 --- a/resources/templates/table/relation/foreign_key_row.twig +++ b/resources/templates/table/relation/foreign_key_row.twig @@ -3,10 +3,10 @@ {% set js_msg = '' %} {% set this_params = null %} - {% if one_key['constraint'] is defined %} + {% if one_key.constraint is defined %} {% set drop_fk_query = 'ALTER TABLE ' ~ backquote(db) ~ '.' ~ backquote(table) ~ ' DROP FOREIGN KEY ' - ~ backquote(one_key['constraint']) ~ ';' + ~ backquote(one_key.constraint) ~ ';' %} {% set this_params = url_params %} {% set this_params = { @@ -14,12 +14,12 @@ 'back': url('/table/relation'), 'sql_query': drop_fk_query, 'message_to_show': t('Foreign key constraint %s has been dropped')|format( - one_key['constraint'] + one_key.constraint ) } %} - {% set js_msg = 'ALTER TABLE ' ~ db ~ '.' ~ table ~ ' DROP FOREIGN KEY ' ~ one_key['constraint'] ~ ';' %} + {% set js_msg = 'ALTER TABLE ' ~ db ~ '.' ~ table ~ ' DROP FOREIGN KEY ' ~ one_key.constraint ~ ';' %} {% endif %} - {% if one_key['constraint'] is defined %} + {% if one_key.constraint is defined %} {% set drop_str = get_icon('b_drop', t('Drop')) %} @@ -29,17 +29,17 @@
{# For ON DELETE and ON UPDATE, the default action is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE won't display the clause if it's set as RESTRICT. #} - {% set on_delete = one_key['on_delete'] is defined - ? one_key['on_delete'] : 'RESTRICT' %} - {% set on_update = one_key['on_update'] is defined - ? one_key['on_update'] : 'RESTRICT' %} + {% set on_delete = one_key.onDelete is defined + ? one_key.onDelete : 'RESTRICT' %} + {% set on_update = one_key.onUpdate is defined + ? one_key.onUpdate : 'RESTRICT' %} {% include 'table/relation/dropdown_generate.twig' with { 'dropdown_question': 'ON DELETE', @@ -59,8 +59,8 @@
- {% if one_key['index_list'] is defined %} - {% for key, column in one_key['index_list'] %} + {% if one_key.indexList is defined %} + {% for key, column in one_key.indexList %} {% include 'table/relation/dropdown_generate.twig' with { 'dropdown_question': '', @@ -108,7 +108,7 @@ {% if foreign_db and foreign_table %} - {% for foreign_column in one_key['ref_index_list'] %} + {% for foreign_column in one_key.refIndexList %} {% include 'table/relation/relational_dropdown.twig' with { 'name': 'destination_foreign_column[' ~ i ~ '][]', diff --git a/src/ConfigStorage/Relation.php b/src/ConfigStorage/Relation.php index b03e4f328b..bcbb74be16 100644 --- a/src/ConfigStorage/Relation.php +++ b/src/ConfigStorage/Relation.php @@ -14,7 +14,7 @@ use PhpMyAdmin\Identifiers\TableName; use PhpMyAdmin\InternalRelations; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\CreateStatement; -use PhpMyAdmin\SqlParser\Utils\Table as TableUtils; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Table\Table; use PhpMyAdmin\Util; use PhpMyAdmin\Version; @@ -37,7 +37,6 @@ use function is_string; use function ksort; use function mb_check_encoding; use function mb_strlen; -use function mb_strtolower; use function mb_strtoupper; use function mb_substr; use function natcasesort; @@ -46,6 +45,7 @@ use function sprintf; use function str_contains; use function str_replace; use function strnatcasecmp; +use function strtolower; use function trim; use function uksort; use function usort; @@ -370,8 +370,9 @@ class Relation * @param string $table the name of the table to check for * @param string $column the name of the column to check for * @param string $source the source for foreign key information + * @psalm-param 'both'|'internal'|'foreign' $source * - * @return mixed[] db,table,column + * @return array> */ public function getForeigners(string $db, string $table, string $column = '', string $source = 'both'): array { @@ -389,40 +390,30 @@ class Relation $relQuery .= ' AND `master_field` = ' . $this->dbi->quoteString($column); } + /** @var array> $foreign */ $foreign = $this->dbi->fetchResult($relQuery, 'master_field', null, ConnectionType::ControlUser); } if (($source === 'both' || $source === 'foreign') && $table !== '') { - $tableObj = new Table($table, $db, $this->dbi); - $showCreateTable = $tableObj->showCreate(); - if ($showCreateTable !== '') { - $parser = new Parser($showCreateTable); - $stmt = $parser->statements[0]; - $foreign['foreign_keys_data'] = []; - if ($stmt instanceof CreateStatement) { - $foreign['foreign_keys_data'] = TableUtils::getForeignKeys($stmt); - } - } + $foreign['foreign_keys_data'] = $this->getForeignKeysData($table, $db); } /** * Emulating relations for some information_schema tables */ - $isInformationSchema = mb_strtolower($db) === 'information_schema'; - $isMysql = mb_strtolower($db) === 'mysql'; - if (($isInformationSchema || $isMysql) && ($source === 'internal' || $source === 'both')) { - if ($isInformationSchema) { - $internalRelations = InternalRelations::INFORMATION_SCHEMA; - } else { - $internalRelations = InternalRelations::MYSQL; - } + if ( + in_array(strtolower($db), ['information_schema', 'mysql'], true) + && ($source === 'internal' || $source === 'both') + ) { + $internalRelations = strtolower($db) === 'information_schema' + ? InternalRelations::INFORMATION_SCHEMA + : InternalRelations::MYSQL; if (isset($internalRelations[$table])) { foreach ($internalRelations[$table] as $field => $relations) { if ( - ($column !== '' && $column != $field) - || (isset($foreign[$field]) - && $foreign[$field] != '') + ($column !== '' && $column !== $field) + || (isset($foreign[$field]) && $foreign[$field] != '') ) { continue; } @@ -435,6 +426,22 @@ class Relation return $foreign; } + /** @return list */ + private function getForeignKeysData(string $table, string $db): array + { + $tableObj = new Table($table, $db, $this->dbi); + $showCreateTable = $tableObj->showCreate(); + if ($showCreateTable !== '') { + $parser = new Parser($showCreateTable); + $stmt = $parser->statements[0]; + if ($stmt instanceof CreateStatement) { + return $stmt->getForeignKeys(); + } + } + + return []; + } + /** * Gets the display field of a table * @@ -1346,15 +1353,16 @@ class Relation } $foreigner = []; + /** @var ForeignKey $oneKey */ foreach ($foreigners['foreign_keys_data'] as $oneKey) { - $columnIndex = array_search($column, $oneKey['index_list']); + $columnIndex = array_search($column, $oneKey->indexList); if ($columnIndex !== false) { - $foreigner['foreign_field'] = $oneKey['ref_index_list'][$columnIndex]; - $foreigner['foreign_db'] = $oneKey['ref_db_name'] ?? Current::$database; - $foreigner['foreign_table'] = $oneKey['ref_table_name']; - $foreigner['constraint'] = $oneKey['constraint']; - $foreigner['on_update'] = $oneKey['on_update'] ?? 'RESTRICT'; - $foreigner['on_delete'] = $oneKey['on_delete'] ?? 'RESTRICT'; + $foreigner['foreign_field'] = $oneKey->refIndexList[$columnIndex]; + $foreigner['foreign_db'] = $oneKey->refDbName ?? Current::$database; + $foreigner['foreign_table'] = $oneKey->refTableName; + $foreigner['constraint'] = $oneKey->constraint; + $foreigner['on_update'] = $oneKey->onUpdate ?? 'RESTRICT'; + $foreigner['on_delete'] = $oneKey->onDelete ?? 'RESTRICT'; return $foreigner; } @@ -1528,25 +1536,6 @@ class Relation $this->getRelationParameters(); } - /** - * Gets the relations info and status, depending on the condition - * - * @param bool $condition whether to look for foreigners or not - * @param string $db database name - * @param string $table table name - * - * @return mixed[] - */ - public function getRelationsAndStatus(bool $condition, string $db, string $table): array - { - if ($condition) { - // Find which tables are related with the current one and write it in an array - return $this->getForeigners($db, $table); - } - - return []; - } - /** * Verifies that all pmadb features are disabled */ diff --git a/src/Controllers/Database/DataDictionaryController.php b/src/Controllers/Database/DataDictionaryController.php index 18a8e6524a..c8cfad3ffd 100644 --- a/src/Controllers/Database/DataDictionaryController.php +++ b/src/Controllers/Database/DataDictionaryController.php @@ -50,11 +50,9 @@ final class DataDictionaryController implements InvocableController $this->dbi->getTableIndexes(Current::$database, $tableName), ); - $foreigners = $this->relation->getRelationsAndStatus( - $relationParameters->relationFeature !== null, - Current::$database, - $tableName, - ); + $foreigners = $relationParameters->relationFeature !== null + ? $this->relation->getForeigners(Current::$database, $tableName) + : []; $columnsComments = $this->relation->getComments(Current::$database, $tableName); diff --git a/src/Controllers/Table/RelationController.php b/src/Controllers/Table/RelationController.php index c41b708797..a61bfc8624 100644 --- a/src/Controllers/Table/RelationController.php +++ b/src/Controllers/Table/RelationController.php @@ -18,6 +18,7 @@ use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Index; use PhpMyAdmin\MessageType; use PhpMyAdmin\ResponseRenderer; +use PhpMyAdmin\SqlParser\Utils\ForeignKey as UtilsForeignKey; use PhpMyAdmin\Table\Table; use PhpMyAdmin\Template; use PhpMyAdmin\Util; @@ -183,18 +184,17 @@ final class RelationController implements InvocableController } $foreignKeyRow = ''; + /** @var list $existrelForeign */ $existrelForeign = array_key_exists('foreign_keys_data', $relationsForeign) ? $relationsForeign['foreign_keys_data'] : []; $i = 0; foreach ($existrelForeign as $oneKey) { - /** @var string $foreignDb */ - $foreignDb = $oneKey['ref_db_name'] ?? Current::$database; + $foreignDb = $oneKey->refDbName ?? Current::$database; $foreignTable = false; if ($foreignDb !== '') { - /** @var string|false $foreignTable */ - $foreignTable = $oneKey['ref_table_name'] ?? false; + $foreignTable = $oneKey->refTableName ?? false; $tables = $this->relation->getTables($foreignDb, $storageEngine); } else { $tables = $this->relation->getTables(Current::$database, $storageEngine); diff --git a/src/Database/Designer/Common.php b/src/Database/Designer/Common.php index 1370c569c4..43b20c5b9e 100644 --- a/src/Database/Designer/Common.php +++ b/src/Database/Designer/Common.php @@ -11,6 +11,7 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Dbal\ConnectionType; use PhpMyAdmin\Index; use PhpMyAdmin\Query\Generator as QueryGenerator; +use PhpMyAdmin\SqlParser\Utils\ForeignKey as UtilsForeignKey; use PhpMyAdmin\Table\Table; use PhpMyAdmin\Util; use PhpMyAdmin\Utils\ForeignKey; @@ -130,21 +131,17 @@ class Common $row = $this->relation->getForeigners(Current::$database, $val, '', 'foreign'); - // We do not have access to the foreign keys if the user has partial access to the columns - if (! isset($row['foreign_keys_data'])) { - continue; - } - + /** @var UtilsForeignKey $oneKey */ foreach ($row['foreign_keys_data'] as $oneKey) { - foreach ($oneKey['index_list'] as $index => $oneField) { - $con['C_NAME'][$i] = rawurlencode($oneKey['constraint']); + foreach ($oneKey->indexList as $index => $oneField) { + $con['C_NAME'][$i] = rawurlencode($oneKey->constraint); $con['DTN'][$i] = rawurlencode(Current::$database . '.' . $val); $con['DCN'][$i] = rawurlencode($oneField); $con['STN'][$i] = rawurlencode( - ($oneKey['ref_db_name'] ?? Current::$database) - . '.' . $oneKey['ref_table_name'], + ($oneKey->refDbName ?? Current::$database) + . '.' . $oneKey->refTableName, ); - $con['SCN'][$i] = rawurlencode($oneKey['ref_index_list'][$index]); + $con['SCN'][$i] = rawurlencode($oneKey->refIndexList[$index]); $i++; } } diff --git a/src/Display/Results.php b/src/Display/Results.php index 4fce39bea8..a38adccc67 100644 --- a/src/Display/Results.php +++ b/src/Display/Results.php @@ -26,6 +26,7 @@ use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Sql; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\SelectStatement; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\SqlParser\Utils\Query; use PhpMyAdmin\SqlParser\Utils\StatementInfo; use PhpMyAdmin\SqlParser\Utils\StatementType; @@ -3493,18 +3494,19 @@ class Results $rel['foreign_db'], ); } else { + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - foreach ($oneKey['index_list'] as $index => $oneField) { + foreach ($oneKey->indexList as $index => $oneField) { $displayField = $this->relation->getDisplayField( - $oneKey['ref_db_name'] ?? Current::$database, - $oneKey['ref_table_name'], + $oneKey->refDbName ?? Current::$database, + $oneKey->refTableName, ); $map[$oneField] = new ForeignKeyRelatedTable( - $oneKey['ref_table_name'], - $oneKey['ref_index_list'][$index], + $oneKey->refTableName, + $oneKey->refIndexList[$index], $displayField, - $oneKey['ref_db_name'] ?? Current::$database, + $oneKey->refDbName ?? Current::$database, ); } } diff --git a/src/Plugins/Export/ExportHtmlword.php b/src/Plugins/Export/ExportHtmlword.php index 1005e7bf45..f04b50e6a4 100644 --- a/src/Plugins/Export/ExportHtmlword.php +++ b/src/Plugins/Export/ExportHtmlword.php @@ -336,11 +336,9 @@ class ExportHtmlword extends ExportPlugin $dbi->selectDb($db); // Check if we can use Relations - $foreigners = $this->relation->getRelationsAndStatus( - $doRelation && $relationParameters->relationFeature !== null, - $db, - $table, - ); + $foreigners = $doRelation && $relationParameters->relationFeature !== null + ? $this->relation->getForeigners($db, $table) + : []; /** * Displays the table structure diff --git a/src/Plugins/Export/ExportLatex.php b/src/Plugins/Export/ExportLatex.php index e0a1525ca8..5ad445936b 100644 --- a/src/Plugins/Export/ExportLatex.php +++ b/src/Plugins/Export/ExportLatex.php @@ -473,11 +473,9 @@ class ExportLatex extends ExportPlugin $dbi->selectDb($db); // Check if we can use Relations - $foreigners = $this->relation->getRelationsAndStatus( - $doRelation && $relationParameters->relationFeature !== null, - $db, - $table, - ); + $foreigners = $doRelation && $relationParameters->relationFeature !== null ? + $this->relation->getForeigners($db, $table) + : []; /** * Displays the table structure */ diff --git a/src/Plugins/Export/ExportOdt.php b/src/Plugins/Export/ExportOdt.php index 0171e511f3..55451a7bd0 100644 --- a/src/Plugins/Export/ExportOdt.php +++ b/src/Plugins/Export/ExportOdt.php @@ -423,11 +423,9 @@ class ExportOdt extends ExportPlugin $dbi->selectDb($db); // Check if we can use Relations - $foreigners = $this->relation->getRelationsAndStatus( - $doRelation && $relationParameters->relationFeature !== null, - $db, - $table, - ); + $foreigners = $doRelation && $relationParameters->relationFeature !== null ? + $this->relation->getForeigners($db, $table) + : []; /** * Displays the table structure */ diff --git a/src/Plugins/Export/ExportSql.php b/src/Plugins/Export/ExportSql.php index 727839ebb2..ec0d88fdfd 100644 --- a/src/Plugins/Export/ExportSql.php +++ b/src/Plugins/Export/ExportSql.php @@ -32,6 +32,7 @@ use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\CreateStatement; use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\SqlParser\TokenType; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Triggers\Triggers; use PhpMyAdmin\UniqueCondition; use PhpMyAdmin\Util; @@ -1747,11 +1748,9 @@ class ExportSql extends ExportPlugin $schemaCreate = ''; // Check if we can use Relations - $foreigners = $this->relation->getRelationsAndStatus( - $doRelation && $relationParameters->relationFeature !== null, - $db, - $table, - ); + $foreigners = $doRelation && $relationParameters->relationFeature !== null ? + $this->relation->getForeigners($db, $table) + : []; $mimeMap = null; if ($doMime && $relationParameters->browserTransformationFeature !== null) { @@ -1821,8 +1820,9 @@ class ExportSql extends ExportPlugin ), ); } else { + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - foreach ($oneKey['index_list'] as $index => $field) { + foreach ($oneKey->indexList as $index => $field) { $relFieldAlias = ! empty( $aliases[$db]['tables'][$table]['columns'][$field] ) ? $aliases[$db]['tables'][$table]['columns'][$field] @@ -1838,13 +1838,13 @@ class ExportSql extends ExportPlugin . $this->exportComment( ' ' . Util::backquoteCompat( - $oneKey['ref_table_name'], + $oneKey->refTableName, 'NONE', $this->useSqlBackquotes, ) . ' -> ' . Util::backquoteCompat( - $oneKey['ref_index_list'][$index], + $oneKey->refIndexList[$index], 'NONE', $this->useSqlBackquotes, ), diff --git a/src/Plugins/Export/ExportTexytext.php b/src/Plugins/Export/ExportTexytext.php index 332d2dc189..8dd696e790 100644 --- a/src/Plugins/Export/ExportTexytext.php +++ b/src/Plugins/Export/ExportTexytext.php @@ -352,11 +352,9 @@ class ExportTexytext extends ExportPlugin $dbi->selectDb($db); // Check if we can use Relations - $foreigners = $this->relation->getRelationsAndStatus( - $doRelation && $relationParameters->relationFeature !== null, - $db, - $table, - ); + $foreigners = $doRelation && $relationParameters->relationFeature !== null ? + $this->relation->getForeigners($db, $table) + : []; /** * Displays the table structure diff --git a/src/Plugins/Schema/Dia/DiaRelationSchema.php b/src/Plugins/Schema/Dia/DiaRelationSchema.php index c3b94b09f2..40a50dbff7 100644 --- a/src/Plugins/Schema/Dia/DiaRelationSchema.php +++ b/src/Plugins/Schema/Dia/DiaRelationSchema.php @@ -10,6 +10,7 @@ namespace PhpMyAdmin\Plugins\Schema\Dia; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\ExportRelationSchema; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use function in_array; @@ -115,17 +116,18 @@ class DiaRelationSchema extends ExportRelationSchema continue; } + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables, true)) { + if (! in_array($oneKey->refTableName, $alltables, true)) { continue; } - foreach ($oneKey['index_list'] as $index => $oneField) { + foreach ($oneKey->indexList as $index => $oneField) { $this->addRelation( $oneTable, $oneField, - $oneKey['ref_table_name'], - $oneKey['ref_index_list'][$index], + $oneKey->refTableName, + $oneKey->refIndexList[$index], $this->showKeys, ); } diff --git a/src/Plugins/Schema/Eps/EpsRelationSchema.php b/src/Plugins/Schema/Eps/EpsRelationSchema.php index 20b43e8fb5..ee12612f9a 100644 --- a/src/Plugins/Schema/Eps/EpsRelationSchema.php +++ b/src/Plugins/Schema/Eps/EpsRelationSchema.php @@ -10,6 +10,7 @@ namespace PhpMyAdmin\Plugins\Schema\Eps; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\ExportRelationSchema; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Version; use function __; @@ -126,19 +127,20 @@ class EpsRelationSchema extends ExportRelationSchema continue; } + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables, true)) { + if (! in_array($oneKey->refTableName, $alltables, true)) { continue; } - foreach ($oneKey['index_list'] as $index => $oneField) { + foreach ($oneKey->indexList as $index => $oneField) { $this->addRelation( $oneTable, $this->eps->getFont(), $this->eps->getFontSize(), $oneField, - $oneKey['ref_table_name'], - $oneKey['ref_index_list'][$index], + $oneKey->refTableName, + $oneKey->refIndexList[$index], $this->tableDimension, ); } diff --git a/src/Plugins/Schema/Pdf/PdfRelationSchema.php b/src/Plugins/Schema/Pdf/PdfRelationSchema.php index 98d979c6c6..2ca39b351c 100644 --- a/src/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/src/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -13,6 +13,7 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Pdf as PdfLib; use PhpMyAdmin\Plugins\Schema\ExportRelationSchema; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Transformations; use PhpMyAdmin\Util; @@ -215,18 +216,14 @@ class PdfRelationSchema extends ExportRelationSchema continue; } + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables, true)) { + if (! in_array($oneKey->refTableName, $alltables, true)) { continue; } - foreach ($oneKey['index_list'] as $index => $oneField) { - $this->addRelation( - $oneTable, - $oneField, - $oneKey['ref_table_name'], - $oneKey['ref_index_list'][$index], - ); + foreach ($oneKey->indexList as $index => $oneField) { + $this->addRelation($oneTable, $oneField, $oneKey->refTableName, $oneKey->refIndexList[$index]); } } } diff --git a/src/Plugins/Schema/Svg/SvgRelationSchema.php b/src/Plugins/Schema/Svg/SvgRelationSchema.php index 79f6cd7436..a2be6ab841 100644 --- a/src/Plugins/Schema/Svg/SvgRelationSchema.php +++ b/src/Plugins/Schema/Svg/SvgRelationSchema.php @@ -10,6 +10,7 @@ namespace PhpMyAdmin\Plugins\Schema\Svg; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Plugins\Schema\ExportRelationSchema; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Version; use function __; @@ -141,19 +142,20 @@ class SvgRelationSchema extends ExportRelationSchema continue; } + /** @var ForeignKey $oneKey */ foreach ($rel as $oneKey) { - if (! in_array($oneKey['ref_table_name'], $alltables, true)) { + if (! in_array($oneKey->refTableName, $alltables, true)) { continue; } - foreach ($oneKey['index_list'] as $index => $oneField) { + foreach ($oneKey->indexList as $index => $oneField) { $this->addRelation( $oneTable, $this->svg->getFont(), $this->svg->getFontSize(), $oneField, - $oneKey['ref_table_name'], - $oneKey['ref_index_list'][$index], + $oneKey->refTableName, + $oneKey->refIndexList[$index], $this->tableDimension, ); } diff --git a/src/Table/Table.php b/src/Table/Table.php index a6c15f69cc..2231e92812 100644 --- a/src/Table/Table.php +++ b/src/Table/Table.php @@ -22,6 +22,7 @@ use PhpMyAdmin\Query\Generator as QueryGenerator; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\CreateStatement; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\SqlParser\Utils\Table as TableUtils; use PhpMyAdmin\Triggers\Triggers; use PhpMyAdmin\Util; @@ -1459,13 +1460,13 @@ class Table implements Stringable /** * Function to handle foreign key updates * - * @param mixed[] $destinationForeignDb destination foreign database - * @param mixed[] $multiEditColumnsName multi edit column names - * @param mixed[] $destinationForeignTable destination foreign table - * @param mixed[] $destinationForeignColumn destination foreign column - * @param string[] $optionsArray options array - * @param string $table current table - * @param mixed[] $existrelForeign db, table, column + * @param mixed[] $destinationForeignDb destination foreign database + * @param mixed[] $multiEditColumnsName multi edit column names + * @param mixed[] $destinationForeignTable destination foreign table + * @param mixed[] $destinationForeignColumn destination foreign column + * @param string[] $optionsArray options array + * @param string $table current table + * @param ForeignKey[] $existrelForeign db, table, column * * @return array{string, string, string, bool} */ @@ -1493,7 +1494,7 @@ class Table implements Stringable $foreignTable = $destinationForeignTable[$masterFieldMd5]; $foreignField = $destinationForeignColumn[$masterFieldMd5]; - $refDbName = $existrelForeign[$masterFieldMd5]['ref_db_name'] ?? Current::$database; + $refDbName = $existrelForeign[$masterFieldMd5]->refDbName ?? Current::$database; $emptyFields = false; foreach ($masterField as $key => $oneField) { @@ -1513,23 +1514,19 @@ class Table implements Stringable if (! empty($foreignDb) && ! empty($foreignTable) && ! $emptyFields) { if (isset($existrelForeign[$masterFieldMd5])) { - $constraintName = $existrelForeign[$masterFieldMd5]['constraint']; - $onDelete = ! empty( - $existrelForeign[$masterFieldMd5]['on_delete'] - ) - ? $existrelForeign[$masterFieldMd5]['on_delete'] + $constraintName = $existrelForeign[$masterFieldMd5]->constraint; + $onDelete = ! empty($existrelForeign[$masterFieldMd5]->onDelete) + ? $existrelForeign[$masterFieldMd5]->onDelete : 'RESTRICT'; - $onUpdate = ! empty( - $existrelForeign[$masterFieldMd5]['on_update'] - ) - ? $existrelForeign[$masterFieldMd5]['on_update'] + $onUpdate = ! empty($existrelForeign[$masterFieldMd5]->onUpdate) + ? $existrelForeign[$masterFieldMd5]->onUpdate : 'RESTRICT'; if ( $refDbName != $foreignDb - || $existrelForeign[$masterFieldMd5]['ref_table_name'] != $foreignTable - || $existrelForeign[$masterFieldMd5]['ref_index_list'] != $foreignField - || $existrelForeign[$masterFieldMd5]['index_list'] != $masterField + || $existrelForeign[$masterFieldMd5]->refTableName != $foreignTable + || $existrelForeign[$masterFieldMd5]->refIndexList != $foreignField + || $existrelForeign[$masterFieldMd5]->indexList != $masterField || $_POST['constraint_name'][$masterFieldMd5] != $constraintName || ($_POST['on_delete'][$masterFieldMd5] != $onDelete) || ($_POST['on_update'][$masterFieldMd5] != $onUpdate) @@ -1550,7 +1547,7 @@ class Table implements Stringable if ($drop) { $dropQuery = 'ALTER TABLE ' . Util::backquote($table) . ' DROP FOREIGN KEY ' - . Util::backquote($existrelForeign[$masterFieldMd5]['constraint']) + . Util::backquote($existrelForeign[$masterFieldMd5]->constraint) . ';'; if (! isset($_POST['preview_sql'])) { @@ -1620,12 +1617,12 @@ class Table implements Stringable $sqlQueryRecreate .= $this->getSQLToCreateForeignKey( $table, $masterField, - $existrelForeign[$masterFieldMd5]['ref_db_name'], - $existrelForeign[$masterFieldMd5]['ref_table_name'], - $existrelForeign[$masterFieldMd5]['ref_index_list'], - $existrelForeign[$masterFieldMd5]['constraint'], - $optionsArray[$existrelForeign[$masterFieldMd5]['on_delete'] ?? ''] ?? null, - $optionsArray[$existrelForeign[$masterFieldMd5]['on_update'] ?? ''] ?? null, + $existrelForeign[$masterFieldMd5]->refDbName, + $existrelForeign[$masterFieldMd5]->refTableName, + $existrelForeign[$masterFieldMd5]->refIndexList, + $existrelForeign[$masterFieldMd5]->constraint, + $optionsArray[$existrelForeign[$masterFieldMd5]->onDelete ?? ''] ?? null, + $optionsArray[$existrelForeign[$masterFieldMd5]->onUpdate ?? ''] ?? null, ); if (! isset($_POST['preview_sql'])) { $displayQuery .= $sqlQueryRecreate . "\n"; diff --git a/tests/unit/ConfigStorage/RelationTest.php b/tests/unit/ConfigStorage/RelationTest.php index f6aab3a7d4..39ffb186ca 100644 --- a/tests/unit/ConfigStorage/RelationTest.php +++ b/tests/unit/ConfigStorage/RelationTest.php @@ -11,6 +11,7 @@ use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Current; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Favorites\RecentFavoriteTables; +use PhpMyAdmin\SqlParser\Utils\ForeignKey; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DummyResult; use PHPUnit\Framework\Attributes\CoversClass; @@ -148,6 +149,13 @@ class RelationTest extends AbstractTestCase */ public function testPMASearchColumnInForeigners(): void { + $foreignerKey = new ForeignKey('ad', ['id', 'value']); + $foreignerKey->refDbName = 'GSoC14'; + $foreignerKey->refTableName = 'table_1'; + $foreignerKey->refIndexList = ['id', 'value']; + $foreignerKey->onDelete = 'CASCADE'; + $foreignerKey->onUpdate = 'CASCADE'; + $foreigners = [ 'value' => [ 'master_field' => 'value', @@ -155,17 +163,7 @@ class RelationTest extends AbstractTestCase 'foreign_table' => 'test', 'foreign_field' => 'value', ], - 'foreign_keys_data' => [ - [ - 'constraint' => 'ad', - 'index_list' => ['id', 'value'], - 'ref_db_name' => 'GSoC14', - 'ref_table_name' => 'table_1', - 'ref_index_list' => ['id', 'value'], - 'on_delete' => 'CASCADE', - 'on_update' => 'CASCADE', - ], - ], + 'foreign_keys_data' => [$foreignerKey], ]; $relation = new Relation($this->createDatabaseInterface());