GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (47)

benchmark/memory.php (1 issue)

1
<?php
2
3
const MB = 1048576;
4
const I = 100000;
5
6
function show_memory($message = '')
7
{
8
    echo '------------------------------------------', PHP_EOL;
9
    echo $message, PHP_EOL;
10
    echo '------------------------------------------', PHP_EOL;
11
    echo 'Current memory usage: ',      \memory_get_usage()          / MB, 'MB', PHP_EOL;
12
    echo 'Peak memory usage: ',         \memory_get_peak_usage()     / MB, 'MB', PHP_EOL;
13
    echo 'Current real memory usage: ', \memory_get_usage(true)      / MB, 'MB', PHP_EOL;
14
    echo 'Peak real memory usage: ',    \memory_get_peak_usage(true) / MB, 'MB', PHP_EOL;
15
}
16
17
show_memory('Bare init');
18
19
require \dirname(__DIR__) . '/vendor/autoload.php';
20
21
use React\EventLoop\Factory as EventLoopFactory;
22
use React\EventLoop\TimerInterface;
23
use WyriHaximus\React\ChildProcess\Messenger\Factory as MessengerFactory;
24
use WyriHaximus\React\ChildProcess\Messenger\Messages\Factory as MessagesFactory;
25
use WyriHaximus\React\ChildProcess\Messenger\Messenger;
26
27
show_memory('Begin');
28
29
$loop = EventLoopFactory::create();
0 ignored issues
show
Deprecated Code introduced by
The function React\EventLoop\Factory::create() has been deprecated: 1.2.0 See Loop::get() instead. ( Ignorable by Annotation )

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

29
$loop = /** @scrutinizer ignore-deprecated */ EventLoopFactory::create();

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
30
31
MessengerFactory::parentFromClass(\WyriHaximus\React\ChildProcess\Messenger\ReturnChild::class, $loop)->then(function (Messenger $messenger) use ($loop) {
32
    $messenger->on('error', function ($e) {
33
        echo 'Error: ', \var_export($e, true), PHP_EOL;
34
    });
35
36
    $i = 0;
37
    $loop->addPeriodicTimer(0.00001, function (TimerInterface $timer) use (&$i, $messenger, $loop) {
38
        if ($i >= I) {
39
            $loop->cancelTimer($timer);
40
            $messenger->softTerminate();
41
42
            show_memory('Completed messaging');
43
44
            $loop->addTimer(5, function () {
45
            });
46
47
            return;
48
        }
49
50
        $messenger->rpc(MessagesFactory::rpc('return', [
51
            'i' => $i,
52
            'time' => \time(),
53
        ]));
54
55
        $i++;
56
    });
57
})->done();
58
59
$loop->run();
60
61
show_memory('Done');
62
63
unset($loop);
64
$loop = null;
65
66
show_memory('Removed loop');
67
68
$cycles = \gc_collect_cycles();
69
70
show_memory('gc_collect_cycles: ' . $cycles);
71