mapfile + array prevents word-splitting issues with filenames
containing spaces or other shell-special characters. Affects both
the affected-files listing and the stale-index safety check.
Without this fix, a filename like 'My Module.php' would be split
into 'My' and 'Module.php', causing the disk-existence check to
look for wrong paths.
Extrahiert die Pre-Commit-Checks (lint-staged + PHPUnit) in ein
gemeinsames Script, das sowohl vom Husky-Hook (.husky/pre-commit)
als auch von scripts/safe-commit.sh aufgerufen wird.
Logik:
- lint-staged laeuft immer (HTML/CSS/JS/JSON/MD/PHP-Syntax)
- PHPUnit laeuft nur, wenn PHP-relevante Dateien gestaged sind
(*.php, phpunit.xml, composer.json, composer.lock)
- Safety-Check: alle gestaged PHP-Dateien muessen auf Disk existieren
- Bei Test-Fehler wird der Commit mit Exit-Code != 0 abgebrochen
- Composer-Deps werden nur bei Bedarf installiert (Cache-Hit)