소스 검색

Installation et configuration de phpstan

Vincent 2 년 전
부모
커밋
16c1d033dc
5개의 변경된 파일24개의 추가작업 그리고 31개의 파일을 삭제
  1. 4 1
      .gitignore
  2. 13 2
      composer.json
  3. 0 5
      phpstan.neon
  4. 7 0
      phpstan.neon.dist
  5. 0 23
      tests/Doctrine/Billing/CurrentResidenceAreaExtensionTest.php

+ 4 - 1
.gitignore

@@ -33,8 +33,11 @@ symfony.lock
 
 /coverage/
 
-
 ###> phpunit/phpunit ###
 /phpunit.xml
 .phpunit.result.cache
 ###< phpunit/phpunit ###
+
+###> phpstan ###
+.phpstan.neon
+###< phpstan ###

+ 13 - 2
composer.json

@@ -67,14 +67,19 @@
     "require-dev": {
         "cyclonedx/cyclonedx-php-composer": "^3.4",
         "hautelook/alice-bundle": "^2.11",
+        "phpstan/extension-installer": "^1.2",
         "phpstan/phpstan": "^1.9",
+        "phpstan/phpstan-doctrine": "^1.3",
+        "phpstan/phpstan-phpunit": "^1.3",
+        "phpstan/phpstan-symfony": "^1.2",
         "phpunit/phpunit": "^9.6",
         "rector/rector": "^0.15.13",
         "symfony/debug-bundle": "6.2.*",
         "symfony/maker-bundle": "^1.21",
         "symfony/phpunit-bridge": "^6.2",
         "symfony/stopwatch": "6.2.*",
-        "symfony/web-profiler-bundle": "6.2.*"
+        "symfony/web-profiler-bundle": "6.2.*",
+        "timeweb/phpstan-enum": "^3.1"
     },
     "config": {
         "optimize-autoloader": true,
@@ -84,7 +89,8 @@
         "sort-packages": true,
         "allow-plugins": {
             "cyclonedx/cyclonedx-php-composer": true,
-            "symfony/flex": true
+            "symfony/flex": true,
+            "phpstan/extension-installer": true
         }
     },
     "autoload": {
@@ -125,6 +131,11 @@
         "symfony": {
             "allow-contrib": false,
             "require": "6.2.*"
+        },
+        "phpstan": {
+            "includes": [
+                "extension.neon"
+            ]
         }
     }
 }

+ 0 - 5
phpstan.neon

@@ -1,5 +0,0 @@
-# https://phpstan.org/config-reference
-parameters:
-	level: 5
-	paths:
-		- src

+ 7 - 0
phpstan.neon.dist

@@ -0,0 +1,7 @@
+# https://phpstan.org/config-reference
+parameters:
+	level: 0
+	ignoreErrors :
+	    - '#Attribute class JetBrains\\PhpStorm\\[a-zA-Z]+ does not exist.#'
+	paths:
+		- src

+ 0 - 23
tests/Doctrine/Billing/CurrentResidenceAreaExtensionTest.php

@@ -1,23 +0,0 @@
-<?php
-
-namespace App\Tests\Doctrine\Billing;
-
-use App\Doctrine\Billing\CurrentResidenceAreaExtension;
-use Symfony\Bundle\SecurityBundle\Security;
-use PHPUnit\Framework\TestCase;
-
-class CurrentResidenceAreaExtensionTest extends TestCase
-{
-    private CurrentResidenceAreaExtension $currentResidenceAreaExtension;
-
-    public function setUp(): void
-    {
-        $security = $this->getMockBuilder(Security::class)->disableOriginalConstructor()->getMock();
-        $this->currentResidenceAreaExtension = new CurrentResidenceAreaExtension($security);
-    }
-
-    public function testSmoke():void
-    {
-        $this->assertTrue(true, true);
-    }
-}