Skip to content

Instantly share code, notes, and snippets.

@rvanlaak
Last active November 2, 2017 09:04
Show Gist options
  • Save rvanlaak/7491f2c4f0c456a93f90e31774300b62 to your computer and use it in GitHub Desktop.
Save rvanlaak/7491f2c4f0c456a93f90e31774300b62 to your computer and use it in GitHub Desktop.
Gitlab CI runner to run PHPStan
#!/usr/bin/env bash
## Allows running the latest PHPStan version without having to install the project
##
## See repo at https://github.com/phpstan/phpstan
## Thanks to https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8
URL=`curl -s https://api.github.com/repos/phpstan/phpstan/releases/latest \
| grep "browser_download_url.*phpstan.phar\"" \
| cut -d : -f 2,3 \
| tr -d \"`
curl -L $URL -o phpstan.phar
chmod a+x phpstan.phar
php phpstan.phar analyse -l 3 src
EXIT_CODE=$?
rm phpstan.phar
exit $EXIT_CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment