Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php:
- 8.5
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
runs-on: ubuntu-24.04
continue-on-error: true
strategy:
fail-fast: false
matrix:
php:
- 8.5
Expand Down Expand Up @@ -79,6 +81,7 @@ jobs:
runs-on: windows-2022
continue-on-error: true
strategy:
fail-fast: false
matrix:
php:
- 8.5
Expand All @@ -104,3 +107,39 @@ jobs:
if: ${{ matrix.php >= 7.3 }}
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
if: ${{ matrix.php < 7.3 }}

PHPStan:
name: PHPStan (PHP ${{ matrix.php }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php:
- 8.5
- 8.4
- 8.3
- 8.2
- 8.1
- 8.0
- 7.4
- 7.3
- 7.2
- 7.1
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
ini-file: development
ini-values: disable_functions='' # do not disable PCNTL functions on PHP < 8.1
extensions: sockets, pcntl ${{ matrix.php >= 5.6 && ', event' || '' }} ${{ matrix.php >= 5.4 && ', ev' || '' }}
env:
fail-fast: true # fail step if any extension can not be installed
- name: Install ext-uv on PHP 7+
run: |
sudo apt-get update -q && sudo apt-get install libuv1-dev
echo "yes" | sudo pecl install ${{ matrix.php >= 8.0 && 'uv-0.3.0' || 'uv-0.2.4' }}
php -m | grep -q uv || echo "extension=uv.so" >> "$(php -r 'echo php_ini_loaded_file();')"
- run: composer install
- run: vendor/bin/phpstan
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"php": ">=7.1"
},
"require-dev": {
"phpstan/phpstan": "^1",
"phpunit/phpunit": "^9.6 || ^7.5"
},
"suggest": {
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
level: max

paths:
- src/
- tests/

# ignoreErrors:
# - '#type specified#'
# - '#expects resource, resource\|false given#'
16 changes: 13 additions & 3 deletions src/ExtEvLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
private $futureTickQueue;

/**
* @var SplObjectStorage
* @var SplObjectStorage<TimerInterface, \EvTimer>
*/
private $timers;

Expand Down Expand Up @@ -71,7 +71,7 @@
$this->signals = new SignalsHandler();
}

public function addReadStream($stream, $listener)

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.

Check failure on line 74 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Method React\EventLoop\ExtEvLoop::addReadStream() has no return type specified.
{
$key = (int)$stream;

Expand All @@ -97,7 +97,7 @@
};
}

public function addWriteStream($stream, $listener)

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.

Check failure on line 100 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Method React\EventLoop\ExtEvLoop::addWriteStream() has no return type specified.
{
$key = (int)$stream;

Expand All @@ -110,7 +110,7 @@
$this->writeStreams[$key] = $event;
}

public function removeReadStream($stream)

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.

Check failure on line 113 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Method React\EventLoop\ExtEvLoop::removeReadStream() has no return type specified.
{
$key = (int)$stream;

Expand All @@ -122,7 +122,7 @@
unset($this->readStreams[$key]);
}

public function removeWriteStream($stream)

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.

Check failure on line 125 in src/ExtEvLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Method React\EventLoop\ExtEvLoop::removeWriteStream() has no return type specified.
{
$key = (int)$stream;

Expand Down Expand Up @@ -190,13 +190,21 @@
$this->futureTickQueue->tick();

$hasPendingCallbacks = !$this->futureTickQueue->isEmpty();
/**
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
$wasJustStopped = !$this->running;
$nothingLeftToDo = !$this->readStreams
&& !$this->writeStreams
&& !$this->timers->count()
&& $this->signals->isEmpty();

$flags = Ev::RUN_ONCE;
/**
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
if ($wasJustStopped || $hasPendingCallbacks) {
$flags |= Ev::RUN_NOWAIT;
} elseif ($nothingLeftToDo) {
Expand All @@ -220,11 +228,13 @@
}

foreach ($this->readStreams as $key => $stream) {
$this->removeReadStream($key);
$this->readStreams[$key]->stop();
unset($this->readStreams[$key]);
}

foreach ($this->writeStreams as $key => $stream) {
$this->removeWriteStream($key);
$this->readStreams[$key]->stop();
unset($this->readStreams[$key]);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/ExtEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
*/
final class ExtEventLoop implements LoopInterface
{
private $eventBase;

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.

Check failure on line 25 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$eventBase has no type specified.
private $futureTickQueue;

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.

Check failure on line 26 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$futureTickQueue has no type specified.
private $timerCallback;

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.

Check failure on line 27 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$timerCallback has no type specified.
private $timerEvents;

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.

Check failure on line 28 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$timerEvents has no type specified.
private $streamCallback;

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.

Check failure on line 29 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$streamCallback has no type specified.
private $readEvents = [];

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.1)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.5)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.

Check failure on line 30 in src/ExtEventLoop.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.2)

Property React\EventLoop\ExtEventLoop::$readEvents has no type specified.
private $writeEvents = [];
private $readListeners = [];
private $writeListeners = [];
Expand Down Expand Up @@ -192,6 +192,10 @@
$this->futureTickQueue->tick();

$flags = EventBase::LOOP_ONCE;
/**
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$flags |= EventBase::LOOP_NONBLOCK;
} elseif (!$this->readEvents && !$this->writeEvents && !$this->timerEvents->count() && $this->signals->isEmpty()) {
Expand Down
16 changes: 16 additions & 0 deletions src/ExtUvLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public function run()
$this->futureTickQueue->tick();

$hasPendingCallbacks = !$this->futureTickQueue->isEmpty();
/**
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
$wasJustStopped = !$this->running;
$nothingLeftToDo = !$this->readStreams
&& !$this->writeStreams
Expand All @@ -220,12 +224,20 @@ public function run()
// otherwise use UV::RUN_NOWAIT.
// @link http://docs.libuv.org/en/v1.x/loop.html#c.uv_run
$flags = \UV::RUN_ONCE;
/**
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
if ($wasJustStopped || $hasPendingCallbacks) {
$flags = \UV::RUN_NOWAIT;
} elseif ($nothingLeftToDo) {
break;
}

/**
* @link https://github.com/JetBrains/phpstorm-stubs/pull/1614
* @phpstan-ignore-next-line
*/
\uv_run($this->uv, $flags);
}
}
Expand Down Expand Up @@ -258,6 +270,10 @@ private function removeStream($stream)
if (!isset($this->readStreams[(int) $stream])
&& !isset($this->writeStreams[(int) $stream])) {
\uv_poll_stop($this->streamEvents[(int) $stream]);
/**
* @link https://github.com/JetBrains/phpstorm-stubs/pull/1615
* @phpstan-ignore-next-line
*/
\uv_close($this->streamEvents[(int) $stream]);
unset($this->streamEvents[(int) $stream]);
return;
Expand Down
3 changes: 3 additions & 0 deletions src/SignalsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function call($signal)
}
}

/**
* @phpstan-impure
*/
public function count($signal)
{
if (!isset($this->signals[$signal])) {
Expand Down
13 changes: 11 additions & 2 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ final class StreamSelectLoop implements LoopInterface
private $running;
private $pcntl = false;
private $pcntlPoll = false;
/**
* @var SignalsHandler
*/
private $signals;

public function __construct()
Expand Down Expand Up @@ -183,7 +186,13 @@ public function run()

$this->timers->tick();

// Future-tick queue has pending callbacks ...
/**
* Future-tick queue has pending callbacks ...
*
*
* @link https://github.com/phpstan/phpstan/issues/10566
* @phpstan-ignore-next-line
*/
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$timeout = 0;

Expand Down Expand Up @@ -286,7 +295,7 @@ private function streamSelect(array &$read, array &$write, $timeout)
}
}

/** @var ?callable $previous */
/** @var ?(callable(int, string, string, int): bool) $previous */
$previous = \set_error_handler(function ($errno, $errstr) use (&$previous) {
// suppress warnings that occur when `stream_select()` is interrupted by a signal
// PHP defines `EINTR` through `ext-sockets` or `ext-pcntl`, otherwise use common default (Linux & Mac)
Expand Down
24 changes: 20 additions & 4 deletions tests/ExtEventLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,28 @@ public function createStream()
return $stream;
}

public function writeToStream($stream, $content)
/**
* @group epoll-readable-error
*/
public function testCanUseReadableStreamWithFeatureFds()
{
if ('Linux' !== PHP_OS) {
return parent::writeToStream($stream, $content);
if (PHP_VERSION_ID > 70000) {
$this->markTestSkipped('Memory stream not supported');
}

fwrite($stream, $content);
$this->loop = $this->createLoop(true);

$input = fopen('php://temp/maxmemory:0', 'r+');

fwrite($input, 'x');
ftruncate($input, 0);

$this->loop->addReadStream($input, $this->expectCallableExactly(2));

fwrite($input, "foo\n");
$this->tickLoop($this->loop);

fwrite($input, "bar\n");
$this->tickLoop($this->loop);
}
}
10 changes: 7 additions & 3 deletions tests/StreamSelectLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function testStreamSelectReportsWarningForStreamWithFilter()
$error = null;
$previous = set_error_handler(function ($_, $errstr) use (&$error) {
$error = $errstr;
return true;
});

try {
Expand All @@ -68,7 +69,9 @@ public function testStreamSelectReportsWarningForStreamWithFilter()

$this->assertNotNull($error);

$now = set_error_handler(function () { });
$now = set_error_handler(function () {
return true;
});
restore_error_handler();
$this->assertEquals($previous, $now);
}
Expand Down Expand Up @@ -104,7 +107,9 @@ public function testStreamSelectThrowsWhenCustomErrorHandlerThrowsForStreamWithF

$this->assertInstanceOf(\RuntimeException::class, $e);

$now = set_error_handler(function () { });
$now = set_error_handler(function () {
return true;
});
restore_error_handler();
$this->assertEquals($previous, $now);
}
Expand Down Expand Up @@ -162,7 +167,6 @@ public function testSignalInterruptWithStream($signal)
// add stream to the loop
list($writeStream, $readStream) = $this->createSocketPair();
$this->loop->addReadStream($readStream, function ($stream) {
/** @var $loop LoopInterface */
$read = fgets($stream);
if ($read === "end loop\n") {
$this->loop->stop();
Expand Down
5 changes: 5 additions & 0 deletions tests/bin/12-undefined.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
echo 'never';
});

/**
* We're ignore this line because the test using this file relies on the error caused by it.
*
* @phpstan-ignore-next-line
*/
$undefined->foo('bar');
5 changes: 5 additions & 0 deletions tests/bin/22-stop-uncaught.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
echo 'never';
});

/**
* Ignoring the next line until we raise the minimum PHP version to 7.1
*
* @phpstan-ignore-next-line
*/
set_exception_handler(function (Exception $e) {
echo 'Uncaught error occured' . PHP_EOL;
Loop::stop();
Expand Down
Loading