fix phpstan lvl 9 bugs

This commit is contained in:
Dennis Eichhorn 2022-12-26 20:52:58 +01:00
parent c3e77fde52
commit 45d7273032
3 changed files with 12 additions and 6 deletions

View File

@ -161,8 +161,13 @@ final class ApiController extends Controller
$request->setData('language', $tag['language'], true);
$internalResponse = new HttpResponse();
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, $data);
$question->addTag($internalResponse->get($request->uri->__toString())['response']);
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, null);
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
continue;
}
$question->addTag($data['response']);
} else {
$question->addTag(new NullTag((int) $tag['id']));
}
@ -334,7 +339,8 @@ final class ApiController extends Controller
// @todo: check if is allowed to change
/** @var \Modules\QA\Models\QAAnswer $old */
$old = clone QAAnswerMapper::get()->where('id', (int) $request->getData('id'))->execute();
$old = QAAnswerMapper::get()->where('id', (int) $request->getData('id'))->execute();
$old = clone $old;
/** @var \Modules\QA\Models\QAAnswer $oldAccepted */
$oldAccepted = QAAnswerMapper::get()
@ -413,7 +419,7 @@ final class ApiController extends Controller
public function createQAAppFromRequest(RequestAbstract $request) : QAApp
{
$app = new QAApp();
$app->name = $request->getData('name') ?? '';
$app->name = (string) ($request->getData('name') ?? '');
return $app;
}

View File

@ -58,7 +58,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-foot qa-portlet-foot">
<div class="tag-list">
<?php $tags = $question->getTags(); foreach ($tags as $tag) : ?>
<span class="tag"><?= $tag->icon !== null ? '<i class="' . $this->printHtml($tag->icon ?? '') . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<span class="tag"><?= !empty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
</div>

View File

@ -70,7 +70,7 @@ echo $this->getData('nav')->render();
<div class="portlet-foot qa-portlet-foot">
<div class="tag-list">
<?php $tags = $question->getTags(); foreach ($tags as $tag) : ?>
<span class="tag"><?= $tag->icon !== null ? '<i class="' . $this->printHtml($tag->icon ?? '') . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<span class="tag"><?= !empty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
</div>