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);
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 63a5a40ec8..ae789403af 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -9559,7 +9559,7 @@
$GLOBALS['cfg']['Export']
$GLOBALS['cfg']['Export']
-
+
$GLOBALS['sql_auto_increments']
$GLOBALS['sql_auto_increments']
$GLOBALS['sql_backquotes']
@@ -9607,6 +9607,7 @@
$rel['foreign_table']
$routine
$routine
+ $routine
$table
$token->value
$trigger['create']
@@ -9702,8 +9703,8 @@
Context::escape($alias)
- $GLOBALS['dbi']->getDefinition($db, $type, $routine)
$createQuery
+ $definition
$tableAlias
$tableAlias
$tableAlias