From b79b9e37a0b1f25a724d682a0765b58b6a1aea5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 11 Sep 2022 14:40:12 -0300 Subject: Improve type inference of exportRoutineSQL's $type param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/Plugins/Export/ExportSql.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libraries') diff --git a/libraries/classes/Plugins/Export/ExportSql.php b/libraries/classes/Plugins/Export/ExportSql.php index 8ecc9acb6d..ca4e9413c2 100644 --- a/libraries/classes/Plugins/Export/ExportSql.php +++ b/libraries/classes/Plugins/Export/ExportSql.php @@ -524,17 +524,17 @@ class ExportSql extends ExportPlugin * * @param string $db Database * @param array $aliases Aliases of db/table/columns - * @param string $type Type of exported routine * @param string $name Verbose name of exported routine * @param array $routines List of routines to export * @param string $delimiter Delimiter to use in SQL + * @psalm-param 'FUNCTION'|'PROCEDURE' $type * * @return string SQL query */ protected function exportRoutineSQL( $db, array $aliases, - $type, + string $type, $name, array $routines, $delimiter @@ -555,13 +555,13 @@ class ExportSql extends ExportPlugin . $delimiter . $GLOBALS['crlf']; } - $createQuery = $this->replaceWithAliases( - $GLOBALS['dbi']->getDefinition($db, $type, $routine), - $aliases, - $db, - '', - $flag - ); + if ($type === 'FUNCTION') { + $definition = $GLOBALS['dbi']->getDefinition($db, 'FUNCTION', $routine); + } else { + $definition = $GLOBALS['dbi']->getDefinition($db, 'PROCEDURE', $routine); + } + + $createQuery = $this->replaceWithAliases($definition, $aliases, $db, '', $flag); if (! empty($createQuery) && $GLOBALS['cfg']['Export']['remove_definer_from_definitions']) { // Remove definer clause from routine definitions $parser = new Parser($createQuery); -- cgit v1.2.3