Skip to content

Commit

Permalink
code quality improvements using Rector for PHP 8.2
Browse files Browse the repository at this point in the history
Signed-off-by: Demin Yin <deminy@deminy.net>
  • Loading branch information
deminy committed Dec 13, 2023
1 parent 9ba6084 commit d743aef
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/deminy/swoole-by-examples",
"license": "CC-BY-NC-ND-4.0",
"require": {
"php": ">=8.0"
"php": ">=8.2"
},
"require-dev": {
"swoole/ide-helper": "~5.0"
Expand Down
5 changes: 1 addition & 4 deletions examples/csp/context.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@

run(function () {
$class = new class() {
public string $name;

public function __construct(string $name = '')
public function __construct(public string $name = '')
{
$this->name = $name;
}

public function __destruct()
Expand Down
2 changes: 1 addition & 1 deletion examples/csp/scheduling/mixed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function () {
Swoole\Coroutine::enableScheduler();
});

go(function () {
go(function (): never {
throw new Exception('Quitting.');
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/csp/scheduling/non-preemptive.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function () {
}
});

go(function () {
go(function (): never {
throw new Exception('Quitting.');
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/csp/scheduling/preemptive.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function () {
}
});

go(function () {
go(function (): never {
throw new Exception('Quitting.');
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/heartbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// In this example, we start a TCP server first. When a client is connected, the server checks activities from the
// client every second. If there is no data received from the client within 3 seconds, the server closes the connection.
$serverProcess = new Process(
function () {
function (): never {
$server = new Server('127.0.0.1', 9601);
$server->set(
[
Expand Down

0 comments on commit d743aef

Please sign in to comment.