diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e7176c..2ecaafb 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/ChangeLog.md b/ChangeLog.md index 21a85ee..c6b26d0 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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. diff --git a/composer.json b/composer.json index 7f2688b..9ccb1da 100755 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/src/test/php/websocket/unittest/ListenersTest.class.php b/src/test/php/websocket/unittest/ListenersTest.class.php index 19ae681..74f269c 100755 --- a/src/test/php/websocket/unittest/ListenersTest.class.php +++ b/src/test/php/websocket/unittest/ListenersTest.class.php @@ -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', ]; }); @@ -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')); } @@ -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')); diff --git a/src/test/php/websocket/unittest/WebSocketTest.class.php b/src/test/php/websocket/unittest/WebSocketTest.class.php index 40ca3e3..b0de972 100755 --- a/src/test/php/websocket/unittest/WebSocketTest.class.php +++ b/src/test/php/websocket/unittest/WebSocketTest.class.php @@ -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; } @@ -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(); } @@ -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()); }