Skip to content

Commit d817d6a

Browse files
committed
Upgrade friendsofphp/php-cs-fixer to ^3.0
1 parent 320f15f commit d817d6a

35 files changed

+86
-59
lines changed

.php_cs renamed to .php-cs-fixer.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
1010
EOF;
1111

12-
return PhpCsFixer\Config::create()
12+
return (new PhpCsFixer\Config())
1313
->setRiskyAllowed(true)
1414
->setRules([
1515
'@PSR2' => true,
1616
'@Symfony' => true,
1717
'@DoctrineAnnotation' => true,
1818
'@PhpCsFixer' => true,
1919
'header_comment' => [
20-
'commentType' => 'PHPDoc',
20+
'comment_type' => 'PHPDoc',
2121
'header' => $header,
2222
'separate' => 'none',
2323
'location' => 'after_declare_strict',
@@ -62,11 +62,19 @@
6262
'multiline_whitespace_before_semicolons' => [
6363
'strategy' => 'no_multi_line',
6464
],
65+
'constant_case' => [
66+
'case' => 'lower',
67+
],
68+
'global_namespace_import' => [
69+
'import_classes' => true,
70+
'import_constants' => true,
71+
'import_functions' => true,
72+
],
73+
'phpdoc_to_comment' => false,
6574
'class_attributes_separation' => true,
6675
'combine_consecutive_unsets' => true,
6776
'declare_strict_types' => true,
6877
'linebreak_after_opening_tag' => true,
69-
'lowercase_constants' => true,
7078
'lowercase_static_reference' => true,
7179
'no_useless_else' => true,
7280
'no_unused_imports' => true,

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"symfony/event-dispatcher": "^5.1"
2727
},
2828
"require-dev": {
29-
"ext-mongodb": "*",
30-
"friendsofphp/php-cs-fixer": "^2.14",
29+
"friendsofphp/php-cs-fixer": "^3.0",
3130
"hyperf/command": "^2.0.0",
3231
"hyperf/config": "^2.0.0",
3332
"hyperf/di": "^2.0.0",

example/config/main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Hyperf\GoTask\IPC\SocketIPCReceiver;
2020
use Hyperf\Utils\ApplicationContext;
2121
use Swoole\Process;
22+
2223
use function Swoole\Coroutine\run;
2324

2425
require __DIR__ . '/../../vendor/autoload.php';

example/go2php/main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
use Hyperf\GoTask\IPC\SocketIPCReceiver;
1313
use Swoole\Process;
14+
1415
use function Swoole\Coroutine\run;
1516

1617
require __DIR__ . '/../../vendor/autoload.php';

example/main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Hyperf\GoTask\GoTask;
1313
use Hyperf\GoTask\IPC\SocketIPCSender;
1414
use Swoole\Process;
15+
1516
use function Swoole\Coroutine\run;
1617

1718
require __DIR__ . '/../vendor/autoload.php';

example/mongo_client/main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
* @contact guxi99@gmail.com
1010
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111
*/
12-
1312
use Hyperf\Config\Config;
1413
use Hyperf\GoTask\IPC\SocketIPCSender;
1514
use Hyperf\GoTask\MongoClient\MongoClient;
1615
use Hyperf\GoTask\MongoClient\MongoProxy;
1716
use Swoole\Process;
17+
1818
use function Swoole\Coroutine\run;
1919

2020
require __DIR__ . '/../../vendor/autoload.php';

src/ConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __invoke(): array
7171

7272
public static function address()
7373
{
74-
if (defined("BASE_PATH")) {
74+
if (defined('BASE_PATH')) {
7575
$root = BASE_PATH . '/runtime';
7676
} else {
7777
$root = '/tmp';

src/Exception/GoBuildException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
namespace Hyperf\GoTask\Exception;
1313

14-
class GoBuildException extends \RuntimeException
14+
use RuntimeException;
15+
16+
class GoBuildException extends RuntimeException
1517
{
1618
}

src/Exception/InvalidGoTaskConnectionException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
namespace Hyperf\GoTask\Exception;
1313

14-
class InvalidGoTaskConnectionException extends \RuntimeException
14+
use RuntimeException;
15+
16+
class InvalidGoTaskConnectionException extends RuntimeException
1517
{
1618
}

src/GoTaskConnection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Hyperf\Pool\Pool;
1919
use Psr\Container\ContainerInterface;
2020
use Spiral\Goridge\RPC;
21+
use Throwable;
2122

2223
/**
2324
* Class GoTaskConnection.
@@ -46,7 +47,7 @@ public function __call($name, $arguments)
4647
{
4748
try {
4849
$result = $this->connection->{$name}(...$arguments);
49-
} catch (\Throwable $exception) {
50+
} catch (Throwable $exception) {
5051
$result = $this->retry($name, $arguments, $exception);
5152
}
5253

@@ -79,15 +80,15 @@ public function getActiveConnection()
7980
return $this;
8081
}
8182

82-
protected function retry($name, $arguments, \Throwable $exception)
83+
protected function retry($name, $arguments, Throwable $exception)
8384
{
8485
$logger = $this->container->get(StdoutLoggerInterface::class);
8586
$logger->warning(sprintf('RemoteGoTask::__call failed, because ' . $exception->getMessage()));
8687

8788
try {
8889
$this->reconnect();
8990
$result = $this->connection->{$name}(...$arguments);
90-
} catch (\Throwable $exception) {
91+
} catch (Throwable $exception) {
9192
$this->lastUseTime = 0.0;
9293
throw $exception;
9394
}

0 commit comments

Comments
 (0)