Files
php-curl-class/tests/run_static_analysis_check_phpstan.sh
T
2025-03-08 13:44:18 -05:00

34 lines
816 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 [[ $(echo "${CI_PHP_VERSION} >= 7.4" | bc -l) -eq 1 ]]; 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