diff --git a/.github/workflows/run-static-analysis.yml b/.github/workflows/run-static-analysis.yml index 692c29f..5c77d6e 100644 --- a/.github/workflows/run-static-analysis.yml +++ b/.github/workflows/run-static-analysis.yml @@ -22,8 +22,8 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2, 8.3, 8.4] - laravel: [9.*, 10.*, 11.*] + php: [7.4, 8.0] + laravel: [8.*] dependency-version: [prefer-stable] exclude: - laravel: 11.* @@ -44,7 +44,6 @@ jobs: - name: Install dependencies run: | - composer remove phpro/grumphp --no-update --dev composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 75dc13a..536fc19 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,8 +22,8 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2, 8.3, 8.4] - laravel: ['9.*', '10.*', '11.*'] + php: [7.4, 8.0] + laravel: ['8.*'] dependency-version: [prefer-lowest, prefer-stable] exclude: - laravel: 11.* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ad635d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Base image with PHP 7.4 +FROM php:7.4-cli + +# Arguments to capture UID and GID +ARG HOSTUID +ARG HOSTGID + +# Install Composer +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer + +# Install necessary tools +RUN apt-get update && apt-get install -y \ + sudo \ + git \ + unzip \ + && apt-get clean + +# Create a group and user with matching UID/GID +RUN groupadd -g ${HOSTGID} developer \ + && useradd -m -u ${HOSTUID} -g ${HOSTGID} -s /bin/bash developer \ + && usermod -aG sudo developer \ + && echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +# Set permissions for the working directory +WORKDIR /app +RUN chown -R developer:developer /app + +# Switch to the new user +USER developer + +# Default shell command +CMD ["/bin/bash"] diff --git a/composer.json b/composer.json index 5422d18..46f158c 100644 --- a/composer.json +++ b/composer.json @@ -14,15 +14,15 @@ } ], "require": { - "php": "^8.1", + "php": "7.4.* | 8.0.*", "dompdf/dompdf": "^3.0", - "illuminate/support": "^9|^10|^11" + "illuminate/support": "^8|^9|^10|^11" }, "require-dev": { - "orchestra/testbench": "^7|^8|^9", + "orchestra/testbench": "^6|^7|^8|^9", "squizlabs/php_codesniffer": "^3.5", - "phpro/grumphp": "^2.5", - "larastan/larastan": "^2.7.0" + "phpstan/phpstan": "^2.1" + }, "autoload": { "psr-4": { @@ -52,7 +52,7 @@ "test": "phpunit", "check-style": "phpcs -p --standard=psr12 src/", "fix-style": "phpcbf -p --standard=psr12 src/", - "phpstan": "phpstan analyze --memory-limit=-1" + "phpstan": "./vendor/bin/phpstan analyze --memory-limit=-1" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8bc99b6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ + +services: + php: + build: + context: . + dockerfile: Dockerfile + args: + HOSTUID: "${HOSTUID:-1001}" + HOSTGID: "${HOSTGID:-1001}" + container_name: php74-dev + volumes: + - .:/app + working_dir: /app + tty: true + stdin_open: true diff --git a/phpstan.neon b/phpstan.neon index 41b6b74..674061e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,4 @@ includes: - - vendor/larastan/larastan/extension.neon parameters: reportUnmatchedIgnoredErrors: false @@ -11,3 +10,7 @@ parameters: # This is a global alias that cannot be detected by Larastan. - '#Call to static method loadHTML\(\) on an unknown class PDF\.#' - '#Call to static method loadHTML\(\) on an unknown class Pdf\.#' + - '#Class Barryvdh\\DomPDF\\PDF has PHPDoc tag @method for method \S+\(\) parameter \#\d \$\S+ with no value type specified in iterable type array\.#' + - '#Class Barryvdh\\DomPDF\\PDF has PHPDoc tag @method for method \S+\(\) return type with no value type specified in iterable type array\.#' + - '#Class Barryvdh\\DomPDF\\Facade\\Pdf has PHPDoc tag @method for method \S+\(\) parameter \#\d \$\S+ with no value type specified in iterable type array\.#' + - '#Call to an undefined static method Illuminate\\Support\\Facades\\View::addLocation\(\)\.#'