Created
October 3, 2023 10:59
Revisions
-
amnuts created this gist
Oct 3, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ FROM php:8.2-cli COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer ENV COMPOSER_ALLOW_SUPERUSER 1 RUN apt-get update && apt-get install -y --no-install-recommends git curl zip unzip \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /var/cache/apk/* /usr/share/man /tmp/* RUN composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true RUN composer global require "squizlabs/php_codesniffer=*" RUN composer global require "phpcompatibility/php-compatibility:dev-develop" RUN composer global require "phpunit/phpunit=*" RUN /root/.composer/vendor/bin/phpcs --config-set installed_paths "/root/.composer/vendor/phpcompatibility/php-compatibility" RUN composer global update --lock WORKDIR /app VOLUME /app 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ First build the docker image ```bash docker build -t php-compatibility-checker . ``` Then you can use the `runon` script to start the the check on the docker container. The path supplied can be relative (assumes you have `readlink` installed on your machine) or absolute, and works to check that single location for all the PHP files not excluded by the ignore rules in the script: ```bash ./runon.sh ../../path/to/your/php/files ``` or: ```bash ./runon.sh /path/to/your/php/files ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash if [[ "$1" == "" ]]; then echo "Usage: $0 <path to check>" exit 1 fi MOUNT_PATH=$(readlink -f "$1") docker run --rm -v "$MOUNT_PATH:/app" php-compatibility-checker /root/.composer/vendor/bin/phpcs \ -d memory_limit=1G --standard=PHPCompatibility --runtime-set testVersion 8.2 --extensions=php \ --ignore=*/vendor/* --ignore=*/storage/* --ignore=*/bootstrap/cache/* --ignore=*/tests/* -p \ /app