Skip to content

Commit

Permalink
Drop support for PHP < 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Oct 5, 2024
1 parent c51731f commit e2239ef
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ WebSockets change log

## ?.?.? / ????-??-??

* Dropped support for PHP < 7.4, see xp-framework/rfc#343 - @thekid
* **Heads up:** The `websocket.Listener`'s *close()* method now has two
additional parameters, *code* and *reason*, which need to be added to
implementations.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"xp-framework/networking": "^10.0 | ^9.3",
"xp-framework/logging": "^11.0 | ^10.0 | ^9.1",
"xp-forge/uri": "^2.0 | ^1.4",
"php": ">=7.0.0"
"php": ">=7.4.0"
},
"require-dev" : {
"xp-framework/test": "^2.0 | ^1.0"
Expand Down
10 changes: 5 additions & 5 deletions src/test/php/websocket/unittest/ListenersTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public function listener($path, $expected) {
$listeners= $this->fixture(function($events) {
return [
'/listen' => newinstance(Listener::class, [], [
'message' => function($conn, $payload) { return 'listen'; }
'message' => fn($conn, $payload) => 'listen',
]),
'/test' => function($conn, $payload) { return 'test'; },
'/' => function($conn, $payload) { return 'catch-all'; }
'/test' => fn($conn, $payload) => 'test',
'/' => fn($conn, $payload) => 'catch-all',
];
});

Expand All @@ -78,7 +78,7 @@ public function listener($path, $expected) {
#[Test, Values(['/', '/test'])]
public function catch_all_when_returning_listener($path) {
$listener= function($conn, $payload) { return 'test'; };
$listeners= $this->fixture(function($events) use($listener) { return $listener; });
$listeners= $this->fixture(fn($events) => $listener);

Assert::equals('test', $listeners->listener($path)->message(null, 'Test'));
}
Expand All @@ -87,7 +87,7 @@ public function catch_all_when_returning_listener($path) {
public function no_catch_all() {
$listeners= $this->fixture(function($events) {
return [
'/test' => function($conn, $payload) { return 'test'; },
'/test' => fn($conn, $payload) => 'test',
];
});
Assert::null($listeners->listener('/prod'));
Expand Down
8 changes: 3 additions & 5 deletions src/test/php/websocket/unittest/WebSocketTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private function fixture($payload= '') {
"\r\n".
$payload
));
$fixture->random(function($bytes) { return str_repeat('*', $bytes); });
$fixture->random(fn($bytes) => str_repeat('*', $bytes));
return $fixture;
}

Expand Down Expand Up @@ -84,7 +84,7 @@ public function lowercase_headers() {
"sec-websocket-accept: pT25h6EVFbWDyyinkmTBvzUVxQo=\r\n".
"\r\n"
));
$fixture->random(function($bytes) { return str_repeat('*', $bytes); });
$fixture->random(fn($bytes) => str_repeat('*', $bytes));
$fixture->connect();
}

Expand Down Expand Up @@ -135,9 +135,7 @@ public function handle_server_error() {
$fixture= $this->fixture("\x88\x02\x03\xea");
$fixture->connect();

Assert::throws(ProtocolException::class, function() use($fixture) {
$fixture->receive();
});
Assert::throws(ProtocolException::class, fn() => $fixture->receive());
Assert::false($fixture->connected());
}

Expand Down

0 comments on commit e2239ef

Please sign in to comment.