File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ METHOD(spawn)
229229 }
230230
231231 if (UNEXPECTED (ZEND_ASYNC_SCOPE_IS_CLOSED (& scope_object -> scope -> scope ))) {
232- async_throw_error ("Cannot spawn coroutine in a closed scope" );
232+ async_throw_error ("Cannot spawn a coroutine in a closed scope" );
233233 RETURN_THROWS ();
234234 }
235235
Original file line number Diff line number Diff line change 2020 return "test " ;
2121 });
2222 echo "ERROR: Should have thrown exception \n" ;
23- } catch (Error $ e ) {
23+ } catch (Async \ AsyncException $ e ) {
2424 echo "Caught expected error: " . $ e ->getMessage () . "\n" ;
2525} catch (Throwable $ e ) {
2626 echo "Caught exception: " . get_class ($ e ) . ": " . $ e ->getMessage () . "\n" ;
4040 return "test2 " ;
4141 });
4242 echo "ERROR: Should have thrown exception \n" ;
43- } catch (Error $ e ) {
43+ } catch (Async \ AsyncException $ e ) {
4444 echo "Caught expected error for safely disposed: " . $ e ->getMessage () . "\n" ;
4545} catch (Throwable $ e ) {
4646 echo "Caught exception: " . get_class ($ e ) . ": " . $ e ->getMessage () . "\n" ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ spawnWith() - scope provider returns null (valid case)
44<?php
55
66use function Async \spawnWith ;
7+ use function Async \await ;
78
89echo "start \n" ;
910
1920 $ coroutine = spawnWith (new NullScopeProvider (), function () {
2021 return "success " ;
2122 });
22- echo "Null provider result: " . $ coroutine ->getResult () . "\n" ;
23+
24+ echo "Null provider result: " . await ($ coroutine ) . "\n" ;
2325} catch (Throwable $ e ) {
2426 echo "Unexpected exception: " . get_class ($ e ) . ": " . $ e ->getMessage () . "\n" ;
2527}
You can’t perform that action at this time.
0 commit comments