diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 246126ec..719a9e04 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -5,7 +5,7 @@ on: - pull_request permissions: - contents: read # to fetch code (actions/checkout) + contents: read jobs: tests: @@ -21,6 +21,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" dependencies: [highest] @@ -39,8 +40,7 @@ jobs: composer-options: "--ignore-platform-req=php+" steps: - - name: "Checkout" - uses: "actions/checkout@v4" + - uses: "actions/checkout@v4" - name: Run CouchDB timeout-minutes: 3 @@ -54,8 +54,7 @@ jobs: with: mongodb-version: 5.0 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - uses: "shivammathur/setup-php@v2" with: coverage: "none" php-version: "${{ matrix.php-version }}" @@ -71,8 +70,7 @@ jobs: composer require --no-update --no-interaction --dev elasticsearch/elasticsearch:^7 composer config --no-plugins allow-plugins.ocramius/package-versions true - - name: "Update dependencies with composer" - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v2" with: dependency-versions: "${{ matrix.dependencies }}" composer-options: "${{ matrix.composer-options }}" @@ -114,8 +112,7 @@ jobs: - "7.17.0" steps: - - name: "Checkout" - uses: "actions/checkout@v4" + - uses: "actions/checkout@v4" # required for elasticsearch - name: Configure sysctl limits @@ -131,8 +128,7 @@ jobs: with: stack-version: "${{ matrix.es-version }}" - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - uses: "shivammathur/setup-php@v2" with: coverage: "none" php-version: "${{ matrix.php-version }}" @@ -147,8 +143,7 @@ jobs: if: "matrix.php-version == '7.4' && matrix.dependencies == 'lowest'" run: "composer config allow-plugins.ocramius/package-versions true" - - name: "Update dependencies with composer" - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v2" with: dependency-versions: "${{ matrix.dependencies }}" @@ -161,7 +156,7 @@ jobs: composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar composer require --no-update --no-interaction --dev ruflin/elastica:^7 elasticsearch/elasticsearch:^7 composer require --no-update psr/log:^3 - composer update -W + composer update composer exec phpunit -- --group Elasticsearch,Elastica tests-es-8: @@ -190,8 +185,7 @@ jobs: - "8.2.0" steps: - - name: "Checkout" - uses: "actions/checkout@v4" + - uses: "actions/checkout@v4" # required for elasticsearch - name: Configure sysctl limits @@ -207,8 +201,7 @@ jobs: with: stack-version: "${{ matrix.es-version }}" - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - uses: "shivammathur/setup-php@v2" with: coverage: "none" php-version: "${{ matrix.php-version }}" @@ -225,8 +218,7 @@ jobs: if: "matrix.php-version == '7.4' && matrix.dependencies == 'lowest'" run: "composer config allow-plugins.ocramius/package-versions true" - - name: "Update dependencies with composer" - uses: "ramsey/composer-install@v2" + - uses: "ramsey/composer-install@v2" with: dependency-versions: "${{ matrix.dependencies }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0db61e04..8272c533 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,11 +1,11 @@ name: "PHP Lint" on: - push: - pull_request: + - push + - pull_request permissions: - contents: read # to fetch code (actions/checkout) + contents: read jobs: tests: @@ -17,19 +17,27 @@ jobs: matrix: php-version: - "8.1" - - "8.3" + - "nightly" steps: - - name: "Checkout" - uses: "actions/checkout@v4" + - uses: actions/checkout@v4 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - uses: shivammathur/setup-php@v2 with: - coverage: "none" - extensions: "intl" - ini-values: "memory_limit=-1" php-version: "${{ matrix.php-version }}" + coverage: none - name: "Lint PHP files" - run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f" + run: | + hasErrors=0 + for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*' ! -path '*/Fixtures/*') + do + { error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1; + if [ "$error" != "" ]; then + while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error" + hasErrors=1 + fi + done + if [ $hasErrors -eq 1 ]; then + exit 1 + fi diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index b3314065..8be7f87c 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -4,11 +4,8 @@ on: - push - pull_request -env: - COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" - permissions: - contents: read # to fetch code (actions/checkout) + contents: read jobs: tests: @@ -22,32 +19,20 @@ jobs: - "8.1" steps: - - name: "Checkout" - uses: "actions/checkout@v4" + - uses: actions/checkout@v4 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - uses: shivammathur/setup-php@v2 with: - coverage: "none" php-version: "${{ matrix.php-version }}" + coverage: none extensions: mongodb, redis, amqp - - name: Get composer cache directory - id: composercache - run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - name: Add require for mongodb/mongodb to make tests runnable run: "composer require ${{ env.COMPOSER_FLAGS }} mongodb/mongodb --dev --no-update" - - name: "Install latest dependencies" - run: "composer update ${{ env.COMPOSER_FLAGS }}" + - uses: ramsey/composer-install@v3 + with: + dependency-versions: highest - name: Run PHPStan run: composer phpstan diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cd24242b..fc128942 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -70,11 +70,6 @@ parameters: count: 1 path: src/Monolog/Logger.php - - - message: "#^Only numeric types are allowed in post\\-decrement, int\\|null given\\.$#" - count: 1 - path: src/Monolog/Logger.php - - message: "#^Parameter \\#1 \\$level \\('alert'\\|'critical'\\|'debug'\\|'emergency'\\|'error'\\|'info'\\|'notice'\\|'warning'\\|Monolog\\\\Level\\) of method Monolog\\\\Logger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\LoggerInterface\\:\\:log\\(\\)$#" count: 1 diff --git a/tests/Monolog/SignalHandlerTest.php b/tests/Monolog/SignalHandlerTest.php index e08930ac..586e8431 100644 --- a/tests/Monolog/SignalHandlerTest.php +++ b/tests/Monolog/SignalHandlerTest.php @@ -186,7 +186,7 @@ class SignalHandlerTest extends TestCase $logger = new Logger('test', [$handler = new TestHandler]); $errHandler = new SignalHandler($logger); $previousCalled = 0; - pcntl_signal(SIGURG, function ($signo, array $siginfo = null) use (&$previousCalled) { + pcntl_signal(SIGURG, function ($signo, ?array $siginfo = null) use (&$previousCalled) { ++$previousCalled; }); $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, $callPrevious, false, false);