mirror of
https://github.com/Karaka-Management/oms-Tag.git
synced 2026-01-11 07:38:41 +00:00
fix phpstan lvl 9 bugs
This commit is contained in:
parent
0c00383430
commit
8e670f3a27
|
|
@ -17,8 +17,7 @@
|
|||
"tag_icon": {
|
||||
"name": "tag_icon",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": true,
|
||||
"default": null
|
||||
"null": false
|
||||
},
|
||||
"tag_type": {
|
||||
"name": "tag_type",
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ final class ApiController extends Controller
|
|||
public function apiTagUpdate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
/** @var Tag $old */
|
||||
$old = clone TagMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$old = TagMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$old = clone $old;
|
||||
$new = $this->updateTagFromRequest($request);
|
||||
$this->updateModel($request->header->account, $old, $new, TagMapper::class, 'tag', $request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Tag', 'Tag successfully updated', $new);
|
||||
|
|
@ -190,7 +191,7 @@ final class ApiController extends Controller
|
|||
{
|
||||
$tag = new Tag();
|
||||
$tag->color = \str_pad($request->getData('color') ?? '#000000ff', 9, 'f');
|
||||
$tag->icon = $request->getData('icon');
|
||||
$tag->icon = (string) ($request->getData('icon') ?? '');
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ class Tag implements \JsonSerializable
|
|||
/**
|
||||
* Icon.
|
||||
*
|
||||
* @var null|string
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $icon = null;
|
||||
public string $icon = '';
|
||||
|
||||
/**
|
||||
* Creator.
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ class BaseView extends View
|
|||
*/
|
||||
public function render(mixed ...$data) : string
|
||||
{
|
||||
/** @var array{0:string, 1:string, 2:string, 3:null|bool} $data */
|
||||
$this->id = $data[0];
|
||||
$this->name = $data[1];
|
||||
$this->form = $data[2];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><label for="iColor"><?= $this->getHtml('Color'); ?></label>
|
||||
<tr><td><input type="color" name="color" id="iColor"required>
|
||||
<tr><td><label for="iIcon"><?= $this->getHtml('Icon'); ?></label>
|
||||
<tr><td><input type="text" name="icon" id="iIcon" placeholder=" oms" value="<?= $this->printHtml($tag->icon ?? ''); ?>">
|
||||
<tr><td><input type="text" name="icon" id="iIcon" placeholder=" oms" value="<?= $this->printHtml($tag->icon); ?>">
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><label for="iColor"><?= $this->getHtml('Color'); ?></label>
|
||||
<tr><td><input type="color" name="color" id="iColor" value="<?= $this->printHtml(\substr($tag->color, 0, 7)); ?>" required>
|
||||
<tr><td><label for="iIcon"><?= $this->getHtml('Icon'); ?></label>
|
||||
<tr><td><input type="text" name="icon" id="iIcon" placeholder=" oms" value="<?= $this->printHtml($tag->icon ?? ''); ?>">
|
||||
<tr><td><input type="text" name="icon" id="iIcon" placeholder=" oms" value="<?= $this->printHtml($tag->icon); ?>">
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user