diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 7ef2337..6f0cd3c 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -12,8 +12,9 @@ jobs:
strategy:
matrix:
php-version:
- - "7.4"
- - "8.0"
+ - "8.1"
+ - "8.2"
+ - "8.3"
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index 68b4249..f85e752 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Exspecto
-[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/)
+[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.1-8892BF.svg)](https://php.net/)
Small PHP DSL for synchronizing asynchronous operations (busy-waiting).
@@ -21,6 +21,11 @@ await()->atMost(3)->pollInterval(200)->until(function() {
});
```
+You can also await for given value in case the returning method (closure) could throw an exception:
+```php
+$value = await()->atMost(3)->pollInterval(200)->on(fn() => getValue());
+```
+
---
*exspecto* - from latin: *wait for*, *await*
diff --git a/composer.json b/composer.json
index 5b18fbb..9ac6421 100644
--- a/composer.json
+++ b/composer.json
@@ -17,12 +17,12 @@
}
],
"require": {
- "php": ">=7.4"
+ "php": ">=8.1"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "^3.2",
+ "php-cs-fixer/shim": "^3.48",
"phpstan/phpstan": "^1.10",
- "phpunit/phpunit": "^9.5"
+ "phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
@@ -37,6 +37,9 @@
"Akondas\\Exspecto\\Tests\\": "tests/"
}
},
+ "config": {
+ "sort-packages": true
+ },
"scripts": {
"build": [
"@check-cs",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 60a4c4e..bb156da 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,26 +1,22 @@
tests
-
-
+
+
diff --git a/tests/AwaitTest.php b/tests/AwaitTest.php
index f9c45b0..b0b68a0 100644
--- a/tests/AwaitTest.php
+++ b/tests/AwaitTest.php
@@ -34,9 +34,7 @@ public function testAwaitTimeout(): void
{
$this->expectException(TimeoutException::class);
- await()->atMost(100, Duration::MILLISECONDS)->pollInterval(30)->until(function (): bool {
- return false;
- });
+ await()->atMost(100, Duration::MILLISECONDS)->pollInterval(30)->until(fn (): bool => false);
}
public function testReturnValue(): void
diff --git a/tests/DurationTest.php b/tests/DurationTest.php
index 2844388..d041bb7 100644
--- a/tests/DurationTest.php
+++ b/tests/DurationTest.php
@@ -22,7 +22,7 @@ public function testFromUnit($duration, string $unit, int $expected): void
/**
* @return array
*/
- public function durationsProvider(): array
+ public static function durationsProvider(): array
{
return [
[1, Duration::SECONDS, 1_000_000],