From 2eecc14f88cdfba79b7e62e20c868e7620bf402d Mon Sep 17 00:00:00 2001
From: Camille Simiand <camille.simiand@tetras-libre.fr>
Date: Thu, 6 Jan 2022 16:01:05 +0100
Subject: [PATCH] Fix phpstan configuration files and scripts

---
 build/phpstan/console-loader.php | 11 -----------
 composer.json                    |  4 ++--
 phpstan-tests.neon               |  8 ++++----
 phpstan.neon                     |  8 ++++----
 4 files changed, 10 insertions(+), 21 deletions(-)
 delete mode 100644 build/phpstan/console-loader.php

diff --git a/build/phpstan/console-loader.php b/build/phpstan/console-loader.php
deleted file mode 100644
index ed52958..0000000
--- a/build/phpstan/console-loader.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php declare(strict_types = 1);
-
-use App\Kernel;
-use Symfony\Bundle\FrameworkBundle\Console\Application;
-use Symfony\Component\Dotenv\Dotenv;
-
-require dirname(__DIR__) . '/../vendor/autoload.php';
-
-(new Dotenv())->bootEnv(dirname(__DIR__) . '/../.env');
-$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
-return new Application($kernel);
diff --git a/composer.json b/composer.json
index a9eed8e..e5206e8 100644
--- a/composer.json
+++ b/composer.json
@@ -124,8 +124,8 @@
             "@phpstan-general",
             "@phpstan-tests"
         ],
-        "phpstan-general": "phpstan analyse -c phpstan.neon -l 1 src --memory-limit=4G",
-        "phpstan-tests": "phpstan analyse -c phpstan-tests.neon -l 1 tests --memory-limit=4G",
+        "phpstan-general": "php -d memory_limit=4G vendor/bin/phpstan analyse -c phpstan.neon",
+        "phpstan-tests": "php -d memory_limit=4G vendor/bin/phpstan analyse -c phpstan-tests.neon",
         "php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src/ tests/"
     },
     "conflict": {
diff --git a/phpstan-tests.neon b/phpstan-tests.neon
index 036daa4..0067e54 100644
--- a/phpstan-tests.neon
+++ b/phpstan-tests.neon
@@ -1,6 +1,6 @@
 parameters:
+    level: 1
+    paths:
+        - tests/
     symfony:
-        container_xml_path: var/cache/test/App_KernelTestDebugContainer.xml
-        console_application_loader: build/phpstan/console-loader.php
-    doctrine:
-        objectManagerLoader: tests/ObjectManager.php
\ No newline at end of file
+        container_xml_path: var/cache/test/App_KernelTestDebugContainer.xml
\ No newline at end of file
diff --git a/phpstan.neon b/phpstan.neon
index c47ca78..ad7e25e 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,6 +1,6 @@
 parameters:
+    level: 1
+    paths:
+        - src/
     symfony:
-        container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml
-        console_application_loader: build/phpstan/console-loader.php
-    doctrine:
-        objectManagerLoader: tests/ObjectManager.php
\ No newline at end of file
+        container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml
\ No newline at end of file
-- 
GitLab