Passed
Push — master ( 71216c...224397 )
by Waaaaaaaaaa
06:00
created

example.php (1 issue)

Severity
1
<?php
2
3
require __DIR__ . '/vendor/autoload.php';
4
5
$logfile = new Logfile\Logfile('5d428582-7733-151c-4eaf-d23d0ebdca3b    ');
6
$logfile->getSender()->setHost('localhost:3030');
7
$logfile->getSender()->setScheme('http');
8
$logfile->getConfig()->setUser(['id' => '4']);
9
$logfile->getConfig()->setTags([
10
    'php_version' => phpversion(),
11
]);
12
$logfile->getConfig()->setRelease(exec('git log --pretty="%H" -n1 HEAD'));
13
14
$handler = new Logfile\MonologHandler($logfile);
15
16
$logger = new Monolog\Logger('debug');
17
18
$logger->pushProcessor(new Monolog\Processor\ProcessIdProcessor);
19
$logger->pushProcessor(new Monolog\Processor\MemoryUsageProcessor);
20
$logger->pushProcessor(new Monolog\Processor\MemoryPeakUsageProcessor);
21
22
$logger->pushHandler($handler);
23
24
// --------
25
26
set_exception_handler(function (Throwable $e) use($logfile, $logger) {
27
    $logger->error($e->getMessage(), ['exception' => $e]);
28
});
29
30
function fail($how) {
0 ignored issues
show
The parameter $how is not used and could be removed. ( Ignorable by Annotation )

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

30
function fail(/** @scrutinizer ignore-unused */ $how) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    throw new ErrorException('whoops');
32
}
33
34
try {
35
    fail('this');
36
} catch(ErrorException $e) {
37
    throw new RuntimeException('doh!', 0, $e);
38
}
39