Files
php-curl-class/tests/run_static_analysis_check_phpstan.sh
T
2025-03-24 19:45:12 -04:00

34 lines
766 B
Bash
Executable File

#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"
source "set_vars.inc.sh"
# Run commands from the project root directory.
pushd ..
set -x
if true; then
phpstan_args=(--ansi --configuration="tests/phpstan.neon")
# Increase memory limit on local development.
if [[ "${CI}" != "true" ]]; then
phpstan_args+=(--memory-limit=256M)
fi
vendor/bin/phpstan --version
vendor/bin/phpstan analyse "${phpstan_args[@]}" .
if [[ "${?}" -ne 0 ]]; then
echo "❌ Error: phpstan static analysis check failed"
errors+=("phpstan static analysis check failed")
fi
else
echo "⚠️ Skipped running phpstan check"
warnings+=("Skipped running phpstan check")
fi
popd