mirror of
https://github.com/Karaka-Management/oms-Editor.git
synced 2026-01-24 15:28:41 +00:00
fix phpstan lvl 9 bugs
This commit is contained in:
parent
7a91d0b537
commit
520be0d9e1
|
|
@ -108,6 +108,7 @@ final class Installer extends InstallerAbstract
|
|||
$apiApp->moduleManager = $app->moduleManager;
|
||||
$apiApp->eventManager = $app->eventManager;
|
||||
|
||||
/** @var array{type:array} $editorData */
|
||||
foreach ($editorData as $editor) {
|
||||
switch ($editor['type']) {
|
||||
case 'type':
|
||||
|
|
@ -126,11 +127,11 @@ final class Installer extends InstallerAbstract
|
|||
* @param ApplicationAbstract $app Application
|
||||
* @param array $data Type info
|
||||
*
|
||||
* @return EditorDocType
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createType(ApplicationAbstract $app, array $data) : EditorDocType
|
||||
private static function createType(ApplicationAbstract $app, array $data) : array
|
||||
{
|
||||
/** @var \Modules\Editor\Controller\ApiController $module */
|
||||
$module = $app->moduleManager->get('Editor');
|
||||
|
|
@ -143,7 +144,13 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
$module->apiEditorDocTypeCreate($request, $response);
|
||||
|
||||
$type = $response->get('')['response'];
|
||||
$responseData = $response->get('');
|
||||
if (!\is_array($responseData)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var \Modules\Editor\Models\EditorDocType $type */
|
||||
$type = $responseData['response'];
|
||||
$id = $type->getId();
|
||||
|
||||
foreach ($data['l11n'] as $l11n) {
|
||||
|
|
@ -158,6 +165,6 @@ final class Installer extends InstallerAbstract
|
|||
$module->apiEditorDocTypeL11nCreate($request, $response);
|
||||
}
|
||||
|
||||
return $type;
|
||||
return $type->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ final class ApiController extends Controller
|
|||
private function createDocTypeFromRequest(RequestAbstract $request) : EditorDocType
|
||||
{
|
||||
$type = new EditorDocType();
|
||||
$type->name = $request->getData('name');
|
||||
$type->name = (string) ($request->getData('name') ?? '');
|
||||
|
||||
if (!empty($request->getData('title'))) {
|
||||
$type->setL11n($request->getData('title'), $request->getData('lang') ?? $request->getLanguage());
|
||||
|
|
@ -376,7 +376,12 @@ final class ApiController extends Controller
|
|||
|
||||
$internalResponse = new HttpResponse();
|
||||
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, null);
|
||||
$doc->addTag($internalResponse->get($request->uri->__toString())['response']);
|
||||
|
||||
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$doc->addTag($data['response']);
|
||||
} else {
|
||||
$doc->addTag(new NullTag((int) $tag['id']));
|
||||
}
|
||||
|
|
@ -418,7 +423,8 @@ final class ApiController extends Controller
|
|||
public function apiEditorUpdate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
/** @var \Modules\Editor\Models\EditorDoc $old */
|
||||
$old = clone EditorDocMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$old = EditorDocMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$old = clone $old;
|
||||
$new = $this->updateEditorFromRequest($request);
|
||||
$this->updateModel($request->header->account, $old, $new, EditorDocMapper::class, 'doc', $request->getOrigin());
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ class TextView extends View
|
|||
*/
|
||||
public function render(mixed ...$data) : string
|
||||
{
|
||||
/** @var array{0:null|string, 1:null|string, 2:null|string, 3:null|string, 4:null|string, 5:null|string, 6:null|string, 7:null|string, 8:null|string} $data */
|
||||
$this->id = $data[0] ?? '';
|
||||
$this->name = $data[1] ?? '';
|
||||
$this->form = $data[2] ?? '';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-xs-6 overflowfix">
|
||||
<?php foreach ($tags as $tag) : ?>
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>"><?= $tag->icon !== null ? '<i class="' . $this->printHtml($tag->icon ?? '') . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>"><?= !emptty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($editable) : ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user