about summary refs log tree commit diff stats
path: root/utils
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-05-24 14:25:07 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-05-24 14:25:07 +0300
commit3acfdf4eff52d275ad37a736984a62c70616077d (patch)
tree3684db1b8c50b2f0bcf8c91d50d704ed87ca05ce /utils
parent46f578ec0ee85049c578a85c6d634b5f148586a6 (diff)
downloadthe-epube-3acfdf4eff52d275ad37a736984a62c70616077d.tar.gz
the-epube-3acfdf4eff52d275ad37a736984a62c70616077d.tar.xz
update phpstan config & add watcher script
Diffstat (limited to 'utils')
-rw-r--r--utils/phpstan-watcher.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/phpstan-watcher.sh b/utils/phpstan-watcher.sh
new file mode 100644
index 0000000..b83ad91
--- /dev/null
+++ b/utils/phpstan-watcher.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+export PHP_IMAGE=registry.fakecake.org/infra/php8.4-alpine3.22
+
+docker run --rm -v $(pwd):/app \
+	--workdir /app ${PHP_IMAGE} \
+	php84 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw analyze .
+
+echo All done, RC=$?.
+
+while true; do
+	inotifywait . -e close_write -r -t 300 | grep -q .php && \
+		(
+			MODIFIED=$(git ls-files -m | grep .php)
+
+			docker run --rm -v $(pwd):/app -v /tmp/phpstan:/tmp/phpstan \
+				--workdir /app ${PHP_IMAGE} \
+				php84 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw analyze .
+
+			echo All done, RC=$?.
+		)
+	sleep 1
+done