Kaynağa Gözat

phpstan analyse level 0

Chance 2 yıl önce
ebeveyn
işleme
b62eaafd75
3 değiştirilmiş dosya ile 30 ekleme ve 3 silme
  1. 5 1
      composer.json
  2. 25 0
      phpstan.neon
  3. 0 2
      src/Protocols/Http/Session.php

+ 5 - 1
composer.json

@@ -44,11 +44,15 @@
     "require-dev": {
         "pestphp/pest": "2.x-dev",
         "mockery/mockery": "2.0.x-dev",
-        "guzzlehttp/guzzle": "^7.0"
+        "guzzlehttp/guzzle": "^7.0",
+        "phpstan/phpstan": "1.11.x-dev"
     },
     "config": {
         "allow-plugins": {
             "pestphp/pest-plugin": true
         }
+    },
+    "scripts": {
+        "analyse": "phpstan analyse -c phpstan.neon --memory-limit=-1"
     }
 }

+ 25 - 0
phpstan.neon

@@ -0,0 +1,25 @@
+parameters:
+	level: 0
+	paths:
+		- src
+		- tests
+	ignoreErrors:
+	    -
+	        path: src/Events/Revolt.php
+	        messages:
+	            - '#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.#'
+	    -
+	        path: src/Events/Swow.php
+	        messages:
+	            - '#Used function Swow\\Sync\\waitAll not found.#'
+	            - '#Call to static method .* on an unknown class Swow\\.*.#'
+	            - '#Function msleep not found.#'
+	            - '#Function stream_poll_one not found.#'
+	            - '#Caught class Swow\\SignalException not found.#'
+	            - '#Function Swow\\Sync\\waitAll not found.#'
+	    - path: src/Timer.php
+	      message: '#Call to static method getSuspension\(\) on an unknown class Revolt\\EventLoop.#'
+	    - path: tests/Pest.php
+	      message: '#Undefined variable: \$this#'

+ 0 - 2
src/Protocols/Http/Session.php

@@ -17,7 +17,6 @@ declare(strict_types=1);
 namespace Workerman\Protocols\Http;
 
 use Exception;
-use JetBrains\PhpStorm\ArrayShape;
 use RuntimeException;
 use Workerman\Protocols\Http\Session\FileSessionHandler;
 use Workerman\Protocols\Http\Session\SessionHandlerInterface;
@@ -381,7 +380,6 @@ class Session
      *
      * @return array
      */
-    #[ArrayShape(['lifetime' => "int", 'path' => "string", 'domain' => "string", 'secure' => "bool", 'httponly' => "bool", 'samesite' => "string"])]
     public static function getCookieParams(): array
     {
         return [