1 | <?php |
||||
2 | |||||
3 | use Apps\Model\Api\Comments\EntityCommentData; |
||||
4 | use Ffcms\Core\Helper\Date; |
||||
5 | use Ffcms\Core\Helper\Text; |
||||
6 | use Ffcms\Templex\Url\Url; |
||||
0 ignored issues
–
show
|
|||||
7 | |||||
8 | /** @var EntityCommentData[] $comments */ |
||||
9 | /** @var \Ffcms\Core\Arch\View $this */ |
||||
10 | /** @var int $snippet */ |
||||
11 | ?> |
||||
12 | <?php foreach ($comments as $comment):?> |
||||
13 | <div class="mb-1 short-comment"> |
||||
14 | <div class="row mb-1"> |
||||
15 | <div class="col-md-6"> |
||||
16 | <i class="fa fa-user"></i> |
||||
17 | <?php if ((int)$comment['user']['id'] > 0): ?> |
||||
18 | <?= Url::a(['profile/show', [$comment['user']['id']]], $comment['user']['name'], ['style' => 'color: #595959']) ?> |
||||
19 | <?php else: ?> |
||||
20 | <?= $comment['user']['name'] ?> |
||||
21 | <?php endif; ?> |
||||
22 | </div> |
||||
23 | <div class="col-md-6 pull-right"> |
||||
24 | <small class="text-secondary pull-right"> |
||||
25 | <i class="fa fa-calendar"></i> <?= Date::humanize($comment['date']) ?> |
||||
0 ignored issues
–
show
Are you sure
Ffcms\Core\Helper\Date::...anize($comment['date']) of type false|string can be used in echo ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
26 | </small> |
||||
27 | </div> |
||||
28 | </div> |
||||
29 | |||||
30 | <div class="row"> |
||||
31 | <div class="col widget-comment-text"> |
||||
32 | <a href="<?= \App::$Alias->baseUrl . '/' . $comment['app_name'] . '/comments/' . $comment['app_id'] ?>"> |
||||
33 | <?= Text::cut(\App::$Security->strip_tags($comment['text']), 0, $snippet) ?> |
||||
0 ignored issues
–
show
It seems like
App::Security->strip_tags($comment['text']) can also be of type array and null ; however, parameter $text of Ffcms\Core\Helper\Text::cut() 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
Loading history...
|
|||||
34 | </a> |
||||
35 | </div> |
||||
36 | </div> |
||||
37 | </div> |
||||
38 | <?php endforeach; ?> |
||||
39 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: