Issues (7)

src/Chips/Dumps.php (1 issue)

Severity
1
<?php
2
/**
3
 * Dumps (failure)
4
 * User: moyo
5
 * Date: Jul 25, 2019
6
 * Time: 11:06
7
 */
8
9
namespace Carno\Console\Chips;
10
11
use Symfony\Component\Console\Input\ArgvInput;
12
use Symfony\Component\Console\Output\ConsoleOutput;
13
use Symfony\Component\Console\Style\SymfonyStyle;
14
use Throwable;
15
16
trait Dumps
17
{
18
    /**
19
     * @param Throwable $e
20
     * @param int $c
21
     */
22
    protected function failure(Throwable $e, int $c = null) : void
23
    {
24
        $styled = (new SymfonyStyle(new ArgvInput(), new ConsoleOutput()));
25
26
        $styled->title(get_class($e));
27
        $styled->error($e->getMessage());
28
        $styled->note(sprintf('%s:%d', $e->getFile(), $e->getLine()));
29
30
        dump($e);
31
32
        is_null($c) || exit($c);
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
33
    }
34
}
35