From d04a797386971de3eaa73ef31b9646df88e479e8 Mon Sep 17 00:00:00 2001 From: "Oliver G. Mueller" Date: Mon, 18 Mar 2024 09:31:31 +0100 Subject: [PATCH] lifted minimum phpunit version to 10.1.x --- .github/dependabot.yml | 8 +-- .github/workflows/ci.yml | 142 +++++++++++++++++++-------------------- .scrutinizer.yml | 41 ++++++----- .yamllint.yaml | 1 + composer.json | 8 +-- composer.lock | 2 +- src/TimingCollector.php | 4 +- 7 files changed, 102 insertions(+), 104 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0126f33..dfa461b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,7 @@ version: 2 updates: - - package-ecosystem: "composer" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" + - package-ecosystem: "composer" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aa54e3..51b8426 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,87 +1,85 @@ -name: CI +name: "CI" on: - push: - paths-ignore: - - 'README.md' - - 'LICENSE' - branches: [ "main" ] - pull_request: - paths-ignore: - - 'README.md' - - 'LICENSE' - - 'example' - branches: [ "main" ] + push: + paths-ignore: + - "README.md" + - "LICENSE.md" + branches: ["main"] + pull_request: + paths-ignore: + - "README.md" + - "LICENSE.md" + branches: ["main"] permissions: - contents: read + contents: "read" jobs: - test: - runs-on: ubuntu-latest - strategy: - max-parallel: 2 - fail-fast: false - matrix: - php-version: [ - "8.1", - "8.2", - "8.3", - # also try a future version - "8.4" - ] - composer-param: [ - "update --no-progress --prefer-dist --prefer-lowest", - "update --no-progress --prefer-dist" - ] - name: PHP ${{ matrix.php-version }} test - steps: - - name: checkout project - uses: actions/checkout@v4 - with: - # needed by scrutinizer - fetch-depth: 2 + test: + runs-on: "ubuntu-latest" + strategy: + max-parallel: 2 + fail-fast: false + matrix: + php-version: [ + "8.1", + "8.2", + "8.3", + # also try a future version + "8.4" + ] + composer-param: [ + "update --no-progress --prefer-dist --prefer-lowest", + "update --no-progress --prefer-dist" + ] + name: "PHP ${{ matrix.php-version }} test" + steps: + - name: "checkout project" + uses: "actions/checkout@v4" + with: + # needed by scrutinizer + fetch-depth: 2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: bcmath - tools: composer:v2 - # needed by PHPUnit code coverage - coverage: pcov + - name: "Setup PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + extensions: "bcmath" + tools: "composer:v2" + # needed by PHPUnit code coverage + coverage: "pcov" - - name: Validate composer.json and composer.lock - run: composer validate + - name: "Validate composer.json and composer.lock" + run: "composer validate" - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT + - name: "Get composer cache directory" + id: "composer-cache" + run: "echo \"dir=$(composer config cache-dir)\" >> $GITHUB_OUTPUT" - - name: Cache composer dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- + - name: "Cache composer dependencies" + uses: "actions/cache@v3" + with: + path: "${{ steps.composer-cache.outputs.dir }}" + key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}" + restore-keys: "${{ runner.os }}-composer-" - - name: Install dependencies - run: composer ${{ matrix.composer-param }} + - name: "Install dependencies" + run: "composer ${{ matrix.composer-param }}" - # Run phpunit with code coverage - - name: PHPUnit Tests - run: vendor/bin/phpunit --coverage-clover=coverage.clover + # Run phpunit with code coverage + - name: "PHPUnit Tests" + run: "vendor/bin/phpunit --coverage-clover=coverage.clover" - # Uploading reports for analysis - - name: Upload code-coverage to scrutinizer - run: vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover - - - name: Publish code coverage to Code Climate - uses: paambaati/codeclimate-action@v5 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - with: - coverageLocations: | - coverage.clover:clover + # Uploading reports for analysis + - name: "Upload code-coverage to scrutinizer" + run: "vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover" + - name: "Publish code coverage to Code Climate" + uses: "paambaati/codeclimate-action@v5" + env: + CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}" + with: + coverageLocations: | + coverage.clover:clover # vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2115ae2..bdbaa46 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,28 +1,27 @@ imports: - - php + - "php" filter: - paths: [src/*] - excluded_paths: [test/*] + paths: ["src/*"] + excluded_paths: ["test/*"] tools: - external_code_coverage: - timeout: 600 - php_mess_detector: true - php_code_sniffer: - enabled: true - config: - standard: psr1 - sensiolabs_security_checker: true - #php_code_coverage: true - php_pdepend: true - php_loc: - enabled: true - excluded_dirs: [tests] - php_cpd: - enabled: true - excluded_dirs: [tests] + external_code_coverage: + timeout: 600 + php_mess_detector: true + php_code_sniffer: + enabled: true + config: + standard: "psr1" + sensiolabs_security_checker: true + # php_code_coverage: true + php_pdepend: true + php_loc: + enabled: true + excluded_dirs: ["tests"] + php_cpd: + enabled: true + excluded_dirs: ["tests"] before_commands: - - composer install - + - "composer install" diff --git a/.yamllint.yaml b/.yamllint.yaml index d8daf0a..89dacff 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -59,6 +59,7 @@ rules: allowed-values: - "false" - "true" + - "on" yaml-files: - "*.yaml" diff --git a/composer.json b/composer.json index 0a1379f..94e3442 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require": { "php": ">=8.1.0", - "phpunit/phpunit": "^10.0.0 || ^11.0.0", + "phpunit/phpunit": "^10.1.0 || ^11.0.0", "psr/clock": "^1.0.0", "symfony/clock": "^6.4.0 || ^7.0.0" }, @@ -39,9 +39,9 @@ "fakerphp/faker": "^1.23.1", "psalm/plugin-phpunit": "~0.18.4", "rector/rector": "^1.0.2", - "vimeo/psalm": "^5.23.1", - "roave/security-advisories" : "dev-master", - "scrutinizer/ocular" : "dev-master" + "roave/security-advisories": "dev-master", + "scrutinizer/ocular": "dev-master", + "vimeo/psalm": "^5.23.1" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/composer.lock b/composer.lock index 88b401e..c1850ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aa359639ab854947ef848f6244499c0a", + "content-hash": "cd278f0615414fca6c6bc3ea21677150", "packages": [ { "name": "myclabs/deep-copy", diff --git a/src/TimingCollector.php b/src/TimingCollector.php index d571c4a..a6e4987 100644 --- a/src/TimingCollector.php +++ b/src/TimingCollector.php @@ -59,7 +59,7 @@ public function start(string $name): void ]; } } else { - $this->timing[$name]['start'] = $time; + $this->timing[$name]['start'] = $time; $this->totalTiming[$name]['start'] = $time; } } @@ -76,7 +76,7 @@ public function stop(string $name, bool $silent = false): void throw new StopwatchException("Stopwatch {$name} not started"); } - $duration = $time - $this->timing[$name]['start']; + $duration = $time - $this->timing[$name]['start']; $this->timing[$name]['end'] = $time; $this->timing[$name]['duration'] += $duration; ++$this->timing[$name]['times'];