From 5db4bebe42de5e4dd0f4805a1cf1f8b2289731e2 Mon Sep 17 00:00:00 2001 From: Will Power <1619102+willpower232@users.noreply.github.com> Date: Fri, 28 Nov 2025 09:54:00 +0000 Subject: [PATCH 1/3] Update pint.json --- pint.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pint.json b/pint.json index ddc35ef..51502cf 100644 --- a/pint.json +++ b/pint.json @@ -64,6 +64,11 @@ "sort_algorithm": "none" }, "ordered_imports": { + "imports_order" => [ + "class", + "const", + "function" + ], "sort_algorithm": "alpha" }, "ordered_traits": true, @@ -81,4 +86,4 @@ "storage", "bootstrap/cache" ] -} \ No newline at end of file +} From 65d95c5b02149a89af4322cb2e46642e66fcd62c Mon Sep 17 00:00:00 2001 From: Will Power <1619102+willpower232@users.noreply.github.com> Date: Fri, 28 Nov 2025 09:55:52 +0000 Subject: [PATCH 2/3] Apply suggestion from @willpower232 --- pint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pint.json b/pint.json index 51502cf..b1b3bcd 100644 --- a/pint.json +++ b/pint.json @@ -64,7 +64,7 @@ "sort_algorithm": "none" }, "ordered_imports": { - "imports_order" => [ + "imports_order": [ "class", "const", "function" From ac95518a5d2e46b9654bde25ee5e88fb75f62430 Mon Sep 17 00:00:00 2001 From: William Hall Date: Fri, 28 Nov 2025 10:47:19 +0000 Subject: [PATCH 3/3] phpcs --- composer.json | 6 ++++-- phpcs | 23 +++++++++++++++++++++++ phpcs.xml | 28 ++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 phpcs create mode 100644 phpcs.xml diff --git a/composer.json b/composer.json index a2ebe14..c34f44e 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ ], "require": { "php": "^8.1", - "laravel/pint": "^1.0" + "laravel/pint": "^1.0", + "squizlabs/php_codesniffer": "^4.0" }, "require-dev": { }, @@ -21,6 +22,7 @@ } }, "bin": [ + "phpcs", "pint", "pint-test" ], @@ -43,4 +45,4 @@ "code-quality", "psr-12" ] -} \ No newline at end of file +} diff --git a/phpcs b/phpcs new file mode 100644 index 0000000..4b55233 --- /dev/null +++ b/phpcs @@ -0,0 +1,23 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +CONFIG_FILE="$SCRIPT_DIR/phpcs.xml" + +PINT_EXECUTABLE="" +if [ -f "./vendor/squizlabs/php_codesniffer/bin/phpcs" ]; then + PINT_EXECUTABLE="./vendor/squizlabs/php_codesniffer/bin/phpcs" +else + echo "Error: PHP CS not found." + exit 1 +fi + +# Check if config file exists +if [ ! -f "$CONFIG_FILE" ]; then + echo "Error: phpcs.xml config file not found at $CONFIG_FILE" + exit 1 +fi + +# Run pint with the config file and pass through all arguments +echo "Running PHP CS with config: $CONFIG_FILE" +$PINT_EXECUTABLE --standard="$CONFIG_FILE" "$@" diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..fbb4201 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,28 @@ + + + + app + database + tests + + + + + + + + + + + + + + + + + + + + database/ + +