From 705390870675d8eb1cb63144e57f08b714392ab0 Mon Sep 17 00:00:00 2001
From: Jan Wennrich <jan.wennrich@pcsg.de>
Date: Fri, 24 May 2024 17:07:39 +0200
Subject: [PATCH] chore: setup PHP_CodeSniffer for project tooling

---
 .phive/phars.xml |  2 ++
 phpcs.xml.dist   | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 phpcs.xml.dist

diff --git a/.phive/phars.xml b/.phive/phars.xml
index 6984891..3c7dea3 100644
--- a/.phive/phars.xml
+++ b/.phive/phars.xml
@@ -2,4 +2,6 @@
 <phive xmlns="https://phar.io/phive">
   <phar name="phpstan" version="1.11.1" installed="1.11.1" 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"/>
 </phive>
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
new file mode 100644
index 0000000..d48084f
--- /dev/null
+++ b/phpcs.xml.dist
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<ruleset>
+    <!-- Use PSR-12 ruleset -->
+    <rule ref="PSR12"/>
+
+    <!-- Only scan *.php files -->
+    <arg name="extensions" value="php"/>
+
+    <!-- Ignore warnings -->
+    <arg name="warning-severity" value="0"/>
+
+    <!-- Process 64 (or number of CPU cores) files in parallel -->
+    <arg name="parallel" value="64"/>
+
+    <!-- Output relative file paths, by setting the current folder as the basepath -->
+    <arg name="basepath" value="."/>
+
+    <!-- Show colored output -->
+    <arg name="colors"/>
+
+    <!-- Scan everything in the current folder -->
+    <file>.</file>
+</ruleset>
-- 
GitLab