Files
HRM-System/public/syntax-check.php
2026-04-22 11:35:52 +08:00

30 lines
991 B
PHP

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "<h1>Syntax Checking...</h1>";
function check_syntax($file) {
if (!file_exists($file)) {
echo "<p style='color: orange;'>$file: NOT FOUND</p>";
return;
}
// Test if file can be parsed
$command = "php -l " . escapeshellarg($file);
$output = shell_exec($command);
if (strpos($output, 'No syntax errors detected') !== false) {
echo "<p style='color: green;'>$file: OK</p>";
} else {
echo "<p style='color: red;'>$file: SYNTAX ERROR!<br><pre>$output</pre></p>";
}
}
check_syntax(__DIR__ . '/../app/Helpers/helper.php');
check_syntax(__DIR__ . '/../app/Providers/AppServiceProvider.php');
check_syntax(__DIR__ . '/../app/Http/Controllers/AttendanceRecordController.php');
check_syntax(__DIR__ . '/../app/Http/Controllers/LeavePolicyController.php');
check_syntax(__DIR__ . '/../bootstrap/app.php');
check_syntax(__DIR__ . '/../public/repair-cache.php');