From 5b2f7399f6772c913399e8e526a1d0a9c3965707 Mon Sep 17 00:00:00 2001
From: Jan Wennrich <jan.wennrich@pcsg.de>
Date: Fri, 2 Aug 2024 15:53:55 +0200
Subject: [PATCH] chore: set PHPStan to level 5 with baseline

---
 .phive/phars.xml      |  2 +-
 phpstan-baseline.neon | 46 +++++++++++++++++++++++++++++++++++++++++++
 phpstan.dist.neon     |  2 +-
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/.phive/phars.xml b/.phive/phars.xml
index 63a030f..ebb5988 100644
--- a/.phive/phars.xml
+++ b/.phive/phars.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <phive xmlns="https://phar.io/phive">
-  <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/>
+  <phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
   <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
   <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
   <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index e69de29..74b2d37 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -0,0 +1,46 @@
+parameters:
+	ignoreErrors:
+		-
+			message: "#^Call to an undefined method QUI\\\\CRUD\\\\Child\\:\\:isActive\\(\\)\\.$#"
+			count: 1
+			path: ajax/activate.php
+
+		-
+			message: "#^Call to an undefined method QUI\\\\CRUD\\\\Child\\:\\:isActive\\(\\)\\.$#"
+			count: 1
+			path: ajax/deactivate.php
+
+		-
+			message: "#^Call to an undefined method QUI\\\\CRUD\\\\Child\\:\\:getTitle\\(\\)\\.$#"
+			count: 1
+			path: ajax/get.php
+
+		-
+			message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(mixed, mixed\\)\\: int, Closure\\(mixed, mixed\\)\\: bool given\\.$#"
+			count: 1
+			path: ajax/search.php
+
+		-
+			message: "#^Call to an undefined method QUI\\\\CRUD\\\\Child\\:\\:isActive\\(\\)\\.$#"
+			count: 2
+			path: ajax/toggle.php
+
+		-
+			message: "#^Call to method getArticles\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\OrderInterface\\.$#"
+			count: 1
+			path: src/QUI/ERP/Discount/Discount.php
+
+		-
+			message: "#^Parameter \\#2 \\$array of function implode expects array\\|null, string given\\.$#"
+			count: 1
+			path: src/QUI/ERP/Discount/Discount.php
+
+		-
+			message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Discount\\\\Discount\\:\\:canUsedInOrder\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\OrderInterface\\.$#"
+			count: 2
+			path: src/QUI/ERP/Discount/Discount.php
+
+		-
+			message: "#^Parameter \\#2 \\$string of function explode expects string, float\\|int\\<min, \\-1\\>\\|int\\<1, max\\>\\|true given\\.$#"
+			count: 1
+			path: src/QUI/ERP/Discount/PriceFactor.php
diff --git a/phpstan.dist.neon b/phpstan.dist.neon
index 28b833b..56d8bea 100644
--- a/phpstan.dist.neon
+++ b/phpstan.dist.neon
@@ -2,7 +2,7 @@ includes:
     - phpstan-baseline.neon
 
 parameters:
-    level: 1
+    level: 5
     paths:
         - src
         - ajax
-- 
GitLab