Skip to content

Commit

Permalink
Format code by the latest cs-fixer. (#6617)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo authored Mar 23, 2024
1 parent cd5bad6 commit 8f4c573
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Channel/Caller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Channel;

use Closure;
Expand Down
1 change: 1 addition & 0 deletions src/Channel/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Channel;

use Hyperf\Engine\Channel;
Expand Down
1 change: 1 addition & 0 deletions src/Channel/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Channel;

use Hyperf\Engine\Channel;
Expand Down
1 change: 1 addition & 0 deletions src/Concurrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use Hyperf\Context\ApplicationContext;
Expand Down
3 changes: 2 additions & 1 deletion src/Coroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use Hyperf\Context\ApplicationContext;
Expand Down Expand Up @@ -84,7 +85,7 @@ public static function create(callable $callable): int

try {
return $coroutine->getId();
} catch (\Throwable) {
} catch (Throwable) {
return -1;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Exception/ChannelClosedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

use RuntimeException;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/ExceptionThrower.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

use Throwable;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

class InvalidArgumentException extends \InvalidArgumentException
Expand Down
1 change: 1 addition & 0 deletions src/Exception/ParallelExecutionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

use RuntimeException;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/TimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

use RuntimeException;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/WaitTimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine\Exception;

class WaitTimeoutException extends TimeoutException
Expand Down
6 changes: 4 additions & 2 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions src/Locker.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use Hyperf\Engine\Channel;
Expand Down
1 change: 1 addition & 0 deletions src/Parallel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use Hyperf\Coroutine\Exception\ParallelExecutionException;
Expand Down
1 change: 1 addition & 0 deletions src/WaitGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use BadMethodCallException;
Expand Down
1 change: 1 addition & 0 deletions src/Waiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace Hyperf\Coroutine;

use Closure;
Expand Down
1 change: 1 addition & 0 deletions tests/Channel/CallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/Channel/ChannelManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/ConcurrentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use Exception;
Expand Down
1 change: 1 addition & 0 deletions tests/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use HyperfTest\Coroutine\Stub\Bar;
Expand Down
4 changes: 3 additions & 1 deletion tests/CoroutineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use Exception;
Expand All @@ -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;
Expand Down Expand Up @@ -70,7 +72,7 @@ public function testCoroutineParentIdHasBeenDestroyed()
}
}

#[\PHPUnit\Framework\Attributes\Group('NonCoroutine')]
#[Group('NonCoroutine')]
public function testCoroutineInTopCoroutine()
{
run(function () {
Expand Down
4 changes: 3 additions & 1 deletion tests/FunctionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -40,7 +42,7 @@ public function testReturnOfGo()
$this->assertSame('Hyperf', $uniqid);
}

#[\PHPUnit\Framework\Attributes\Group('NonCoroutine')]
#[Group('NonCoroutine')]
public function testRun()
{
$asserts = [
Expand Down
1 change: 1 addition & 0 deletions tests/LockerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use Hyperf\Coroutine\Locker;
Expand Down
4 changes: 3 additions & 1 deletion tests/ParallelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,7 +27,7 @@
* @internal
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Hyperf\Coroutine\Parallel::class)]
#[CoversClass(Parallel::class)]
class ParallelTest extends TestCase
{
public function testParallel()
Expand Down
1 change: 1 addition & 0 deletions tests/Stub/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/Stub/Foo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/WaitGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use Hyperf\Coroutine\WaitGroup;
Expand Down
1 change: 1 addition & 0 deletions tests/WaiterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Coroutine;

use Hyperf\Context\ApplicationContext;
Expand Down

0 comments on commit 8f4c573

Please sign in to comment.