diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-09-11 20:40:12 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-09-11 20:40:12 +0300 |
commit | b79b9e37a0b1f25a724d682a0765b58b6a1aea5c (patch) | |
tree | c762e69eb5a5606a624fbdf322ed38edabb8a036 /libraries | |
parent | 1c844571f53d5fdac30eba63926089ff902379c5 (diff) |
Improve type inference of exportRoutineSQL's $type param
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classes/Plugins/Export/ExportSql.php | 18 |
1 files changed, 9 insertions, 9 deletions
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); |