Skip to content

Instantly share code, notes, and snippets.

@franckweb
Last active October 21, 2022 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franckweb/ab509b57c2be8de9f74d9276c7ffbd07 to your computer and use it in GitHub Desktop.
Save franckweb/ab509b57c2be8de9f74d9276c7ffbd07 to your computer and use it in GitHub Desktop.
PHP compatibility check
# PHP COMPATIBILITY CHECK
# PHP CODE SNIFFER (with compatibility 7.4)
docker run --rm -v $(pwd):/app vfac/php7compatibility 7.4 [folder or file path] --extensions=php --ignore=vendor
# -------
# PHPSTAN (with .neon configs)
docker run --rm -v $(pwd):/app ghcr.io/phpstan/phpstan analyse -c myfolder/phpstan.neon myfiles/*.phptxt > mylogs/mylog.log
# phpstan.configs.neon
parameters:
level: 8 # 1-8 levels
phpVersion: 70400 # PHP 7.4
# -------
# PHAN (with .phan/config.php)
# 1. Generate .phan/config.php with following command and customize extensions, directory, analysis level, etc.
docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" phanphp/phan:latest --init --init-level=5 --init-no-composer --init-analyze-dir=my/scripts/directory
# 2. docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" phanphp/phan:latest -po mylog.txt
# --------
# RECTOR
# Analyze current directory(".")
docker run --init -it --rm -v "$(pwd):/project" -v "$(pwd)/tmp-phpqa:/tmp" -w /project jakzal/phpqa rector process . --dry-run --config rector.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment