Kaynağa Gözat

phpstan analyse level 5

Chance 2 yıl önce
ebeveyn
işleme
50473063b1

+ 3 - 2
phpstan.neon

@@ -1,5 +1,5 @@
 parameters:
-	level: 4
+	level: 5
 	paths:
 		- src
 		- tests
@@ -30,4 +30,5 @@ parameters:
 	    - path: tests/Pest.php
 	      message: '#Undefined variable: \$this#'
 	    - path: src/Worker.php
-	      message: '#Constant LINE_VERSION_LENGTH not found.#'
+	      message: '#Constant LINE_VERSION_LENGTH not found.#'
+	    - message: '#Parameter \#1 \$callback of function set_error_handler expects \(callable\(int, string, string, int\): bool\)\|null,.*#'

+ 1 - 1
tests/Feature/UdpConnectionTest.php

@@ -32,7 +32,7 @@ afterAll(function () use (&$process) {
 
 it('tests udp connection', function () use ($serverAddress) {
     $socket = stream_socket_client($serverAddress, $errno, $errstr, 1);
-    expect($errno)->toBeInt(0);
+    expect($errno)->toBeInt()->toBe(0);
     fwrite($socket, 'xiami');
     $data = fread($socket, 1024);
     expect($data)->toBeString('received: xiami');

+ 1 - 0
tests/Unit/Protocols/HttpTest.php

@@ -95,6 +95,7 @@ it('tests ::encode for ' . Response::class, function () {
 });
 
 it('tests ::decode', function () {
+    /** @var TcpConnection $tcpConnection */
     $tcpConnection = Mockery::mock(TcpConnection::class);
 
     //example request from ChatGPT :)

+ 1 - 0
tests/Unit/Protocols/TextTest.php

@@ -4,6 +4,7 @@ use Workerman\Connection\ConnectionInterface;
 use Workerman\Protocols\Text;
 
 test(Text::class, function () {
+    /** @var ConnectionInterface $connection */
     $connection = Mockery::mock(ConnectionInterface::class);
 
     //::input