fix phpstan lvl 9 bugs

This commit is contained in:
Dennis Eichhorn 2022-12-26 20:52:58 +01:00
parent 93934f5b38
commit 888a4065da
6 changed files with 16 additions and 6 deletions

View File

@ -260,7 +260,12 @@ final class ApiController extends Controller
$internalResponse = new HttpResponse();
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, null);
$task->addTag($internalResponse->get($request->uri->__toString())['response']);
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
continue;
}
$task->addTag($data['response']);
} else {
$task->addTag(new NullTag((int) $tag['id']));
}

View File

@ -165,7 +165,10 @@ final class BackendController extends Controller implements DashboardElementInte
{
$view = new TaskView($this->app->l11nManager, $request, $response);
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
/** @var \Model\Setting $profileImage */
$profileImage = $this->app->appSettings->get(names: SettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
/** @var \Modules\Media\Models\Media $image */
$image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute();
$view->defaultProfileImage = $image;

View File

@ -175,7 +175,8 @@ final class TaskMapper extends DataMapperFactory
->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $user)
->andWhere(AccountRelationMapper::TABLE . '.task_account_duty', '=', DutyType::TO);
return self::getAll()->execute($query);
/** @return array */
return self::getAll()->execute($query); /** @return array */
}
/**

View File

@ -52,6 +52,7 @@ class ListView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0: \Modules\Tasks\Models\Task[]} $data */
$this->tasks = $data[0];
return parent::render();
}

View File

@ -76,7 +76,7 @@ if ($open !== null) :
<td data-label="<?= $this->getHtml('Tag'); ?>">
<?php $tags = $task->getTags(); foreach ($tags as $tag) : ?>
<a href="<?= $url; ?>">
<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); ?>"><?= !empty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
</a>
<?php endforeach; ?>
<td data-label="<?= $this->getHtml('Creator'); ?>">
@ -137,7 +137,7 @@ if ($open !== null) :
<td data-label="<?= $this->getHtml('Tag'); ?>">
<?php $tags = $task->getTags(); foreach ($tags as $tag) : ?>
<a href="<?= $url; ?>">
<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); ?>"><?= !empty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
</a>
<?php endforeach; ?>
<td data-label="<?= $this->getHtml('Creator'); ?>">

View File

@ -97,7 +97,7 @@ echo $this->getData('nav')->render(); ?>
<?php endif; ?>
<?php $tags = $task->getTags(); 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); ?>"><?= !empty($tag->icon) ? '<i class="' . $this->printHtml($tag->icon) . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
</div>
</div>