Skip to content

Instantly share code, notes, and snippets.

@bueltge
Last active June 29, 2021 05:46
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 bueltge/be20bce0f6523653a26cfcb164d9c8b0 to your computer and use it in GitHub Desktop.
Save bueltge/be20bce0f6523653a26cfcb164d9c8b0 to your computer and use it in GitHub Desktop.
Static PHP7 analyses with Phan and PHP 7 Migration Assistant Report (MAR), PHP 5 to PHP7 Migration Tools

Phan

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness. github.com/phan/phan

Install via Composer

composer require --dev phan/phan

note: php-ast is necessary (sudo apt install php-ast)

Help

./vendor/bin/phan -h

Usage

./vendor/bin/phan -b <path>/<file.php>

cd <directory>
find . -name '*.php' | grep -v test > filelist.txt
./vendor/bin/phan -i -b -f filelist.txt

PHP 7 Migration Assistant Report (MAR)

PHP 7 MAR, or just "php7mar", is a command line utility to generate reports on existing PHP 5 code to assist developers in porting their code quickly to PHP 7. github.com/Alexia/php7mar

Install via Composer

composer require --dev alexia/php7mar

Help

php ./vendor/alexia/php7mar/mar.php

Usage

php ./vendor/alexia/php7mar/mar.php -f="<path>/<file.php>"

@bueltge
Copy link
Author

bueltge commented Jan 25, 2020

Also, helpful to migrate php 5 code base to php 7*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment