Merge pull request #18933 from kamil-tekiela/type-hint-in-events-getDetails
Add type hints in Events::getDetails
This commit is contained in:
commit
07176c4f50
@ -1775,11 +1775,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Controllers/Database/DesignerController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'name' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Database/EventsController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method isSuccess\\(\\) on mixed\\.$#"
|
||||
count: 1
|
||||
@ -1787,7 +1782,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 18
|
||||
count: 16
|
||||
path: src/Controllers/Database/EventsController.php
|
||||
|
||||
-
|
||||
@ -1797,7 +1792,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$identifier of static method PhpMyAdmin\\\\Util\\:\\:backquote\\(\\) expects string\\|Stringable\\|null, mixed given\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: src/Controllers/Database/EventsController.php
|
||||
|
||||
-
|
||||
@ -6935,21 +6930,6 @@ parameters:
|
||||
count: 6
|
||||
path: src/Database/Events.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Name' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Database/Events.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Status' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Database/Events.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Type' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Database/Events.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 13
|
||||
|
||||
@ -1024,16 +1024,9 @@
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$event['name']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$event['name']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
<code>$event</code>
|
||||
<code><![CDATA[$item['item_original_name']]]></code>
|
||||
</MixedAssignment>
|
||||
<PossiblyInvalidArgument>
|
||||
@ -4778,11 +4771,6 @@
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$event['Name']]]></code>
|
||||
<code><![CDATA[$event['Status']]]></code>
|
||||
<code><![CDATA[$event['Type']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$GLOBALS['errors'][]]]></code>
|
||||
<code><![CDATA[$GLOBALS['errors'][]]]></code>
|
||||
@ -4796,7 +4784,6 @@
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
<code>$event</code>
|
||||
<code><![CDATA[$retval['item_comment']]]></code>
|
||||
<code><![CDATA[$retval['item_definer']]]></code>
|
||||
<code><![CDATA[$retval['item_definition']]]></code>
|
||||
|
||||
@ -86,25 +86,23 @@ final class EventsController extends AbstractController
|
||||
mb_strtoupper($_POST['item_name']),
|
||||
),
|
||||
);
|
||||
if (! empty($event)) {
|
||||
$sqlDrop = sprintf(
|
||||
'DROP EVENT IF EXISTS %s',
|
||||
Util::backquote($event['name']),
|
||||
);
|
||||
$this->response->addJSON(
|
||||
'new_row',
|
||||
$this->template->render('database/events/row', [
|
||||
'db' => Current::$database,
|
||||
'table' => Current::$table,
|
||||
'event' => $event,
|
||||
'has_privilege' => Util::currentUserHasPrivilege('EVENT', Current::$database),
|
||||
'sql_drop' => $sqlDrop,
|
||||
'row_class' => '',
|
||||
]),
|
||||
);
|
||||
}
|
||||
$sqlDrop = sprintf(
|
||||
'DROP EVENT IF EXISTS %s',
|
||||
Util::backquote($event['name']),
|
||||
);
|
||||
$this->response->addJSON(
|
||||
'new_row',
|
||||
$this->template->render('database/events/row', [
|
||||
'db' => Current::$database,
|
||||
'table' => Current::$table,
|
||||
'event' => $event,
|
||||
'has_privilege' => Util::currentUserHasPrivilege('EVENT', Current::$database),
|
||||
'sql_drop' => $sqlDrop,
|
||||
'row_class' => '',
|
||||
]),
|
||||
);
|
||||
|
||||
$this->response->addJSON('insert', ! empty($event));
|
||||
$this->response->addJSON('insert', true);
|
||||
$this->response->addJSON('message', $output);
|
||||
} else {
|
||||
$this->response->setRequestStatus(false);
|
||||
|
||||
@ -362,7 +362,7 @@ class Events
|
||||
* @param string $db db name
|
||||
* @param string $name event name
|
||||
*
|
||||
* @return mixed[] information about EVENTs
|
||||
* @return array{name:string, type:string, status:string}[] information about EVENTs
|
||||
*/
|
||||
public function getDetails(string $db, string $name = ''): array
|
||||
{
|
||||
@ -381,6 +381,7 @@ class Events
|
||||
$result = [];
|
||||
$events = $this->dbi->fetchResult($query);
|
||||
|
||||
/** @var string[] $event */
|
||||
foreach ($events as $event) {
|
||||
$result[] = ['name' => $event['Name'], 'type' => $event['Type'], 'status' => $event['Status']];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user