Skip to content

Commit 7b406c0

Browse files
makomwebmbonneau
andauthored
PHP 8.4 (#225)
* add Rector as a dev dependency * add rector.php file * update code to PHP 8.4 via Rector * make implicit nullable params explicit via Rector * fix optional scheduler * add type declarations via rector (level 1) * add type declarations via rector (level 2) * Update ci.yml for 8.4 and other updates * Bump PHP version to >=7.1.0 --------- Co-authored-by: Matt Bonneau <[email protected]>
1 parent 50152f5 commit 7b406c0

File tree

230 files changed

+2224
-2201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+2224
-2201
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,23 @@ jobs:
99
name: PHPUnit (PHP ${{ matrix.php }} on ${{ matrix.os }})
1010
runs-on: ${{ matrix.os }}
1111
strategy:
12-
fail-fast: false
12+
fail-fast: true
1313
matrix:
1414
os:
15-
- ubuntu-20.04
16-
- windows-2019
15+
- ubuntu-latest
16+
- windows-latest
1717
php:
18+
- 8.4
1819
- 8.3
1920
- 8.2
2021
- 8.1
21-
- 8.0
22-
- 7.4
23-
- 7.3
24-
- 7.2
2522
steps:
26-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
2724
- uses: shivammathur/setup-php@v2
2825
with:
2926
php-version: ${{ matrix.php }}
3027
coverage: xdebug
31-
- run: composer install
28+
tools: composer
29+
cache: composer
30+
- run: composer install --prefer-dist --no-interaction --no-progress
3231
- run: vendor/bin/phpunit --coverage-text

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
}
2121
],
2222
"require": {
23-
"php": ">=7.0.0",
23+
"php": ">=7.1.0",
2424
"react/promise": "^3 || ~2.2"
2525
},
2626
"require-dev": {
2727
"satooshi/php-coveralls": "~1.0",
2828
"phpunit/phpunit": "^8.5 || ^9",
29-
"react/event-loop": "^1.0 || ^0.5 || ^0.4.2"
29+
"react/event-loop": "^1.0 || ^0.5 || ^0.4.2",
30+
"rector/rector": "^2.0"
3031
},
3132
"suggest": {
3233
"react/event-loop": "Used for scheduling async operations"

demo/bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function asString($value) {
3030

3131
$createStdoutObserver = function ($prefix = '') {
3232
return new Rx\Observer\CallbackObserver(
33-
function ($value) use ($prefix) { echo $prefix . "Next value: " . asString($value) . "\n"; },
34-
function ($error) use ($prefix) { echo $prefix . "Exception: " . $error->getMessage() . "\n"; },
35-
function () use ($prefix) { echo $prefix . "Complete!\n"; }
33+
function ($value) use ($prefix): void { echo $prefix . "Next value: " . asString($value) . "\n"; },
34+
function ($error) use ($prefix): void { echo $prefix . "Exception: " . $error->getMessage() . "\n"; },
35+
function () use ($prefix): void { echo $prefix . "Complete!\n"; }
3636
);
3737
};
3838

@@ -42,6 +42,6 @@ function () use ($prefix) { echo $prefix . "Complete!\n"; }
4242
Scheduler::setDefaultFactory(function () use ($loop) {
4343
return new Scheduler\EventLoopScheduler($loop);
4444
});
45-
register_shutdown_function(function () use ($loop) {
45+
register_shutdown_function(function () use ($loop): void {
4646
$loop->run();
4747
});

demo/create/create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$observer->onNext(42);
1010
$observer->onCompleted();
1111

12-
return new CallbackDisposable(function () {
12+
return new CallbackDisposable(function (): void {
1313
echo "Disposed\n";
1414
});
1515
});

demo/create/createObservable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$observer->onNext(42);
1010
$observer->onCompleted();
1111

12-
return new CallbackDisposable(function () {
12+
return new CallbackDisposable(function (): void {
1313
echo "Disposed\n";
1414
});
1515
});

demo/custom-operator/Rot13Operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Rot13Operator implements OperatorInterface
1515
public function __invoke(ObservableInterface $observable, ObserverInterface $observer): DisposableInterface
1616
{
1717
return $observable->subscribe(
18-
function ($json) use ($observer) {
18+
function ($json) use ($observer): void {
1919
$observer->onNext(str_rot13($json));
2020
},
2121
[$observer, 'onError'],

demo/delay/delay.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require_once __DIR__ . '/../bootstrap.php';
33

44
\Rx\Observable::interval(1000)
5-
->doOnNext(function ($x) {
5+
->doOnNext(function ($x): void {
66
echo 'Side effect: ' . $x . "\n";
77
})
88
->delay(500)

demo/do/do.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
$source = \Rx\Observable::range(0, 3)
66
->do(
7-
function ($x) {
7+
function ($x): void {
88
echo 'Do Next:', $x, PHP_EOL;
99
},
10-
function (Throwable $err) {
10+
function (Throwable $err): void {
1111
echo 'Do Error:', $err->getMessage(), PHP_EOL;
1212
},
13-
function () {
13+
function (): void {
1414
echo 'Do Completed', PHP_EOL;
1515
}
1616
);

demo/do/doOnCompleted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_once __DIR__ . '/../bootstrap.php';
44

55
$source = \Rx\Observable::empty()
6-
->doOnCompleted(function () {
6+
->doOnCompleted(function (): void {
77
echo 'Do Completed', PHP_EOL;
88
});
99

demo/do/doOnError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_once __DIR__ . '/../bootstrap.php';
44

55
$source = \Rx\Observable::error(new Exception('Oops'))
6-
->doOnError(function (Throwable $err) {
6+
->doOnError(function (Throwable $err): void {
77
echo 'Do Error:', $err->getMessage(), PHP_EOL;
88
});
99

0 commit comments

Comments
 (0)