Created
October 23, 2018 10:05
-
-
Save KirovAir/34cbdbff6133625bcb9c0b91a37690ca to your computer and use it in GitHub Desktop.
Set up a quick PHPCompatibility installation on windows using Git.
This file contains hidden or 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
@echo off | |
echo Make sure you have the following installed correctly in your PATH: | |
echo - Git | |
echo - PHP (Or place the php directory in right here so php is in php/php.exe) | |
pause | |
set PHP_PEAR_PHP_BIN=php/php | |
IF EXIST PHP_CodeSniffer ( | |
cd PHP_CodeSniffer | |
git pull | |
cd .. | |
) ELSE ( | |
git clone https://github.com/squizlabs/PHP_CodeSniffer.git | |
) | |
IF EXIST PHPCompatibility ( | |
cd PHPCompatibility | |
git pull | |
cd .. | |
) ELSE ( | |
git clone https://github.com/PHPCompatibility/PHPCompatibility.git | |
) | |
@echo @echo off> phpcs.bat | |
@echo IF EXIST "php/php.exe" (>> phpcs.bat | |
@echo set PHP_PEAR_PHP_BIN=php/php.exe>> phpcs.bat | |
@echo ) ELSE (>> phpcs.bat | |
@echo echo PHP binary not found in dir. Using PATH.>> phpcs.bat | |
@echo )>> phpcs.bat | |
@echo "%%~dp0PHP_CodeSniffer\bin\phpcs" %%*>> phpcs.bat | |
@echo @echo off> phpcbf.bat | |
@echo IF EXIST "php/php.exe" (>> phpcbf.bat | |
@echo set PHP_PEAR_PHP_BIN=php/php.exe>> phpcbf.bat | |
@echo ) ELSE (>> phpcbf.bat | |
@echo echo PHP binary not found in dir. Using PATH.>> phpcbf.bat | |
@echo )>> phpcbf.bat | |
@echo "%%~dp0PHP_CodeSniffer\bin\phpcbf" %%*>> phpcbf.bat | |
cmd /c "phpcs --config-set installed_paths ../PHPCompatibility" | |
echo. | |
echo. | |
echo Done! Example usage: | |
echo phpcs -p "C:\dir\to\project" --standard=PHPCompatibility --runtime-set testVersion 7.0 | |
echo. | |
echo. | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment