Issues (3)

src/helpers.php (1 issue)

Labels
Severity
1
<?php
2
3
use Spatie\Flash\Flash;
4
use Spatie\Flash\Message;
5
6
/**
7
 * @param string $text
8
 * @param string|array $class
9
 */
10
function flash(string $text = null, $class = null): Flash
11
{
12
    /** @var \Spatie\Flash\Flash $flash */
13
    $flash = app(Flash::class);
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

13
    $flash = /** @scrutinizer ignore-call */ app(Flash::class);
Loading history...
14
15
    if (is_null($text)) {
16
        return $flash;
17
    }
18
19
    $message = new Message($text, $class);
20
21
    $flash->flash($message);
22
23
    return $flash;
24
}
25