Skip to content

Commit

Permalink
Require PHP 8.1+ and add mixed type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Nov 19, 2021
1 parent c989ee1 commit 249f9f6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 36 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/.github/ export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/phpunit.xml.legacy export-ignore
/tests/ export-ignore
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ jobs:
matrix:
php:
- 8.1
- 8.0
- 7.4
- 7.3
- 7.2
- 7.1
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
Expand All @@ -25,6 +20,3 @@ jobs:
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
if: ${{ matrix.php < 7.3 }}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,16 @@ $ composer require react/async:dev-main
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP
extensions and supports running on PHP 7.1 through current PHP 8+.
extensions and supports running on PHP 8.1+.
It's *highly recommended to use the latest supported PHP version* for this project.

We're committed to providing long-term support (LTS) options and to provide a
smooth upgrade path. If you're using an older PHP version, you may use the
[`2.x` branch](https://github.com/reactphp/async/tree/2.x) which provides a
compatible API but does not take advantage of newer language features. You may
target both versions at the same time to support a wider range of PHP versions.
[`3.x` branch](https://github.com/reactphp/async/tree/3.x) (PHP 7.1+) or
[`2.x` branch](https://github.com/reactphp/async/tree/2.x) (PHP 5.3+) which both
provide a compatible API but do not take advantage of newer language features.
You may target multiple versions at the same time to support a wider range of
PHP versions.

## Tests

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=8.1",
"react/event-loop": "^1.2",
"react/promise": "^2.8 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^7.5"
"phpunit/phpunit": "^9.3"
},
"autoload": {
"files": [
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
Expand Down
18 changes: 0 additions & 18 deletions phpunit.xml.legacy

This file was deleted.

4 changes: 2 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @throws \Throwable when the promise is rejected with a `Throwable`
* @throws \UnexpectedValueException when the promise is rejected with an unexpected value (Promise API v1 or v2 only)
*/
function await(PromiseInterface $promise)
function await(PromiseInterface $promise): mixed
{
$wait = true;
$resolved = null;
Expand Down Expand Up @@ -212,7 +212,7 @@ function ($error) use (&$exception, &$rejected, &$wait) {
* @return PromiseInterface<mixed>
* @since 3.0.0
*/
function coroutine(callable $function, ...$args): PromiseInterface
function coroutine(callable $function, mixed ...$args): PromiseInterface
{
try {
$generator = $function(...$args);
Expand Down

0 comments on commit 249f9f6

Please sign in to comment.