Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/View/Admin/default/comments/delete.php (2 issues)

Checks if the types of the passed arguments in a function/method call are compatible.

Bug Minor
1
<?php
2
3
use Ffcms\Core\Helper\Date;
4
use Ffcms\Core\Helper\Simplify;
5
use Ffcms\Core\Helper\Type\Str;
6
use Ffcms\Templex\Url\Url;
7
8
/** @var \Ffcms\Templex\Template\Template $this */
9
/** @var Apps\Model\Admin\Comments\FormCommentDelete $model */
10
/** @var string $type */
11
12
$this->layout('_layouts/default', [
13
    'title' => __('Delete comments'),
14
    'breadcrumbs' => [
15
        Url::to('main/index') => __('Main'),
16
        Url::to('widget/index') => __('Widgets'),
17
        Url::to('comments/index') => __('Comments'),
18
        __('Delete comments and answers')
19
    ]
20
]);
21
$records = $model->getRecord();
22
?>
23
24
<?php $this->start('body') ?>
25
26
<?= $this->insert('comments/_tabs') ?>
27
28
<h1><?= __('Delete comments and answers') ?></h1>
29
<?= __('Are you sure to delete this comments or answers?') ?>
30
31
<?php
32
$table = $this->table(['class' => 'table table-striped'])
33
    ->head([
34
        ['text' => '#'],
35
        ['text' => __('Message')],
36
        ['text' => __('Author')],
37
        ['text' => __('Date')]
38
    ]);
39
foreach ($records as $item) {
40
    $table->row([
41
        ['text' => $item->id],
42
        ['text' => Str::sub(\App::$Security->strip_tags($item->message), 0, 50)],
0 ignored issues
show
It seems like App::Security->strip_tags($item->message) can also be of type array and null; however, parameter $string of Ffcms\Core\Helper\Type\Str::sub() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
        ['text' => Str::sub(/** @scrutinizer ignore-type */ \App::$Security->strip_tags($item->message), 0, 50)],
Loading history...
43
        ['text' => Url::a(['user/update', [$item->user_id]], Simplify::parseUserNick($item->user_id, $item->guest_name)), 'html' => true],
0 ignored issues
show
It seems like Ffcms\Core\Helper\Simpli..._id, $item->guest_name) can also be of type null; however, parameter $text of Ffcms\Templex\Url\Url::a() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

43
        ['text' => Url::a(['user/update', [$item->user_id]], /** @scrutinizer ignore-type */ Simplify::parseUserNick($item->user_id, $item->guest_name)), 'html' => true],
Loading history...
44
        ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)]
45
    ]);
46
}
47
48
?>
49
50
<div class="table-responsive"><?= $table->display() ?></div>
51
52
<?php $form = $this->form($model) ?>
53
<?= $form->start() ?>
54
55
<?= $form->button()->submit(__('Delete'), ['class' => 'btn btn-danger'])?>
56
57
<?= $form->stop() ?>
58
59
<?php $this->stop() ?>
60