#!/bin/sh

set -eu

. "$(dirname "$0")/common.sh"

PHP_FILES="$(list_changed_files \
    '*.php' \
    ':!vendor/**' \
    ':!node_modules/**' \
    ':!storage/**' \
    ':!bootstrap/cache/**' \
    ':!public/**' | tr '\n' ' ')"

if [ -z "${PHP_FILES}" ]; then
    echo "No hay archivos PHP modificados para validar sintaxis."
    exit 0
fi

echo "Validando sintaxis en: ${PHP_FILES}"
for file in ${PHP_FILES}; do
    php -l "${file}"
done
