Last active
January 11, 2020 14:12
-
-
Save JackNoordhuis/0c67c789d2964fb17915af839714db93 to your computer and use it in GitHub Desktop.
Bash script for running phpstan on pocketmine plugins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PHPSTAN_CONFIG="/pocketmine/phpstan.neon" | |
ROOT_PATH="$PWD" | |
VERSION="4" | |
while getopts "c:p:v" OPTION 2> /dev/null; do | |
case ${OPTION} in | |
c) | |
PHPSTAN_CONFIG="/source/$OPTARG" | |
;; | |
p) | |
ROOT_PATH="$OPTARG" | |
;; | |
v) | |
VERSION="$OPTARG" | |
;; | |
\?) | |
break | |
;; | |
esac | |
done | |
sh -c "docker run -it -e PHPSTAN_CONFIG=$PHPSTAN_CONFIG -v /$ROOT_PATH:/source nxtlvlsoftware/pmmp-phpstan:$VERSION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the script to your shells path and
cd
into your plugin directory and runphpstan-pm
. If you have aphpstan.neon
config in your plugin directory you can tell phpstan to use it with the-c
option:phpstan -c phpstan.neon
.You can specify the pocketmine API version to run phpstan with by using the
-v
option:phpstan -v 3.11.3
. The latest 3.x.x series is tagged as3
, dev builds of API 4 are available as4
. You can target the latest patch release in a major series as3.11
.If you use your own phpstan config you will need to tell phpstan to autoload the composer generated pocketmine autoload file:
A pocketmine phar is always available at the
/pocketmine/PocketMine.phar
path in the container.