فهرست منبع

phpstan analyse level 2

Chance 2 سال پیش
والد
کامیت
de778cd2ba
5فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 3 1
      phpstan.neon
  2. 2 2
      src/Connection/TcpConnection.php
  3. 1 1
      src/Timer.php
  4. 0 2
      src/Worker.php
  5. 2 0
      tests/Unit/Protocols/HttpTest.php

+ 3 - 1
phpstan.neon

@@ -1,5 +1,5 @@
 parameters:
-	level: 1
+	level: 2
 	paths:
 		- src
 		- tests
@@ -10,6 +10,7 @@ parameters:
 	            - '#Property Workerman\\Events\\Revolt::\$driver has unknown class Revolt\\EventLoop\\Driver as its type.#'
 	            - '#Call to static method getDriver\(\) on an unknown class Revolt\\EventLoop.#'
 	            - '#Method Workerman\\Events\\Revolt::driver\(\) has invalid return type Revolt\\EventLoop\\Driver.#'
+	            - '#Call to method .* on an unknown class Revolt\\EventLoop\\Driver.#'
 	    -
 	        path: src/Events/Swow.php
 	        messages:
@@ -23,6 +24,7 @@ parameters:
 	            - '#Constant STREAM_POLLIN not found.#'
 	            - '#Constant STREAM_POLLNONE not found.#'
 	            - '#Constant STREAM_POLLOUT not found.#'
+	            - '#Property Workerman\\Events\\Swow::.* has unknown class Swow\\Coroutine as its type.#'
 	    - path: src/Timer.php
 	      message: '#Call to static method getSuspension\(\) on an unknown class Revolt\\EventLoop.#'
 	    - path: tests/Pest.php

+ 2 - 2
src/Connection/TcpConnection.php

@@ -53,7 +53,7 @@ use const STREAM_CRYPTO_METHOD_SSLv2_SERVER;
 
 /**
  * TcpConnection.
- * @property string websocketType
+ * @property string $websocketType
  */
 class TcpConnection extends ConnectionInterface implements JsonSerializable
 {
@@ -1033,7 +1033,7 @@ class TcpConnection extends ConnectionInterface implements JsonSerializable
     /**
      * Enable or disable Cache.
      *
-     * @param mixed $value
+     * @param bool $value
      */
     public static function enableCache(bool $value = true): void
     {

+ 1 - 1
src/Timer.php

@@ -107,7 +107,7 @@ class Timer
      *
      * @param float $timeInterval
      * @param callable $func
-     * @param mixed|array $args
+     * @param null|array $args
      * @param bool $persistent
      * @return int
      */

+ 0 - 2
src/Worker.php

@@ -1972,7 +1972,6 @@ class Worker
         if (static::$masterPid === posix_getpid()) {
             $allWorkerInfo = [];
             foreach (static::$pidMap as $workerId => $pidArray) {
-                /** @var /Workerman/Worker $worker */
                 $worker = static::$workers[$workerId];
                 foreach ($pidArray as $pid) {
                     $allWorkerInfo[$pid] = ['name' => $worker->name, 'listen' => $worker->getSocketName()];
@@ -2086,7 +2085,6 @@ class Worker
         $currentWorker = current(static::$workers);
         $defaultWorkerName = $currentWorker->name;
 
-        /** @var static $worker */
         foreach (TcpConnection::$connections as $connection) {
             /** @var TcpConnection $connection */
             $transport = $connection->transport;

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

@@ -55,6 +55,7 @@ it('tests ::input', function () {
 });
 
 it('tests ::encode for non-object response', function () {
+    /** @var TcpConnection $tcpConnection */
     $tcpConnection = Mockery::mock(TcpConnection::class);
     $tcpConnection->headers = [
         'foo' => 'bar',
@@ -73,6 +74,7 @@ it('tests ::encode for non-object response', function () {
 });
 
 it('tests ::encode for ' . Response::class, function () {
+    /** @var TcpConnection $tcpConnection */
     $tcpConnection = Mockery::mock(TcpConnection::class);
     $tcpConnection->headers = [
         'foo' => 'bar',