-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format code by the latest
cs-fixer
. (#6617)
- Loading branch information
1 parent
cd5bad6
commit 8f4c573
Showing
28 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Channel; | ||
|
||
use Closure; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Channel; | ||
|
||
use Hyperf\Engine\Channel; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Channel; | ||
|
||
use Hyperf\Engine\Channel; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Hyperf\Context\ApplicationContext; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Hyperf\Context\ApplicationContext; | ||
|
@@ -84,7 +85,7 @@ public static function create(callable $callable): int | |
|
||
try { | ||
return $coroutine->getId(); | ||
} catch (\Throwable) { | ||
} catch (Throwable) { | ||
return -1; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
use RuntimeException; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
use Throwable; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
class InvalidArgumentException extends \InvalidArgumentException | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
use RuntimeException; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
use RuntimeException; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine\Exception; | ||
|
||
class WaitTimeoutException extends TimeoutException | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,13 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Closure; | ||
use Hyperf\Context\ApplicationContext; | ||
use RuntimeException; | ||
use Swoole\Runtime; | ||
|
||
/** | ||
* @param callable[] $callables | ||
|
@@ -65,11 +67,11 @@ function run($callbacks, int $flags = SWOOLE_HOOK_ALL): bool | |
throw new RuntimeException('Function \'run\' only execute in non-coroutine environment.'); | ||
} | ||
|
||
\Swoole\Runtime::enableCoroutine($flags); | ||
Runtime::enableCoroutine($flags); | ||
|
||
/* @phpstan-ignore-next-line */ | ||
$result = \Swoole\Coroutine\run(...(array) $callbacks); | ||
|
||
\Swoole\Runtime::enableCoroutine(false); | ||
Runtime::enableCoroutine(false); | ||
return $result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Hyperf\Engine\Channel; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Hyperf\Coroutine\Exception\ParallelExecutionException; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use BadMethodCallException; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace Hyperf\Coroutine; | ||
|
||
use Closure; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine\Channel; | ||
|
||
use Hyperf\Coroutine\Channel\Caller; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine\Channel; | ||
|
||
use Hyperf\Coroutine\Channel\Manager as ChannelManager; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Exception; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use HyperfTest\Coroutine\Stub\Bar; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Exception; | ||
|
@@ -20,6 +21,7 @@ | |
use Hyperf\ExceptionHandler\Formatter\FormatterInterface; | ||
use Mockery; | ||
use PHPUnit\Framework\Attributes\CoversNothing; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Container\ContainerInterface; | ||
use Throwable; | ||
|
@@ -70,7 +72,7 @@ public function testCoroutineParentIdHasBeenDestroyed() | |
} | ||
} | ||
|
||
#[\PHPUnit\Framework\Attributes\Group('NonCoroutine')] | ||
#[Group('NonCoroutine')] | ||
public function testCoroutineInTopCoroutine() | ||
{ | ||
run(function () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,13 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Hyperf\Coroutine\Coroutine; | ||
use Hyperf\Engine\Channel; | ||
use PHPUnit\Framework\Attributes\CoversNothing; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\TestCase; | ||
use Swoole\Runtime; | ||
|
||
|
@@ -40,7 +42,7 @@ public function testReturnOfGo() | |
$this->assertSame('Hyperf', $uniqid); | ||
} | ||
|
||
#[\PHPUnit\Framework\Attributes\Group('NonCoroutine')] | ||
#[Group('NonCoroutine')] | ||
public function testRun() | ||
{ | ||
$asserts = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Hyperf\Coroutine\Locker; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,12 +9,14 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Exception; | ||
use Hyperf\Coroutine\Coroutine; | ||
use Hyperf\Coroutine\Exception\ParallelExecutionException; | ||
use Hyperf\Coroutine\Parallel; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use RuntimeException; | ||
use Throwable; | ||
|
@@ -25,7 +27,7 @@ | |
* @internal | ||
* @coversNothing | ||
*/ | ||
#[\PHPUnit\Framework\Attributes\CoversClass(\Hyperf\Coroutine\Parallel::class)] | ||
#[CoversClass(Parallel::class)] | ||
class ParallelTest extends TestCase | ||
{ | ||
public function testParallel() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine\Stub; | ||
|
||
use Hyperf\Support\Traits\Container; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine\Stub; | ||
|
||
use Hyperf\Support\Traits\Container; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Hyperf\Coroutine\WaitGroup; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\Coroutine; | ||
|
||
use Hyperf\Context\ApplicationContext; | ||
|