From aa836e4dbbcb1bd8d207c517e75692b96bba1e79 Mon Sep 17 00:00:00 2001 From: jmsche Date: Tue, 18 Feb 2025 17:50:06 +0100 Subject: [PATCH 1/5] Upgrade PHP requirement to ^8.3 & other vendors --- .github/workflows/coding-standards.yml | 10 +++++----- .github/workflows/continuous-integration.yml | 14 +++++++------- .github/workflows/static-analysis.yml | 8 ++++---- CHANGELOG-1.x.md | 5 +++++ README.md | 2 +- composer.json | 16 ++++++++-------- phpunit.xml.dist | 2 +- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index cb19b59..82843af 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -9,16 +9,16 @@ on: jobs: php-cs-fixer: name: PHP CS Fixer (PHP ${{ matrix.php-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: php-version: - - '8.1' + - '8.4' steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -28,7 +28,7 @@ jobs: tools: cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHP CS Fixer - run: 'vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr' + run: 'PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e2e4d1a..e7e2120 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,17 +9,17 @@ on: jobs: phpunit: name: PHPUnit (PHP ${{ matrix.php-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: php-version: - - '8.1' - - '8.2' + - '8.3' + - '8.4' steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP with pcov uses: shivammathur/setup-php@v2 @@ -28,11 +28,11 @@ jobs: php-version: ${{ matrix.php-version }} - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHPUnit run: vendor/bin/phpunit --coverage-clover=coverage.xml - name: Upload to Codecov - uses: codecov/codecov-action@v3 - if: matrix.php-version == '8.1' + uses: codecov/codecov-action@v5 + if: matrix.php-version == '8.4' diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4d2a3d2..411a38e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,16 +9,16 @@ on: jobs: phpstan: name: PHPStan (PHP ${{ matrix.php-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: php-version: - - '8.1' + - '8.4' steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -28,7 +28,7 @@ jobs: tools: cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHPStan run: 'vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr' diff --git a/CHANGELOG-1.x.md b/CHANGELOG-1.x.md index 0fdc3d1..00bf5a9 100644 --- a/CHANGELOG-1.x.md +++ b/CHANGELOG-1.x.md @@ -1,3 +1,8 @@ +1.1.0 +----- + +* Upgrade PHP requirement to 8.3+ + 1.0.1 ----- diff --git a/README.md b/README.md index 7d19962..183d037 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This package contains a [Flysystem](https://flysystem.thephpleague.com/) adapter ## Installation -This package requires PHP 8.1+ and Flysystem v3. +This package requires PHP 8.3+ and Flysystem v3. You can install the package using composer: diff --git a/composer.json b/composer.json index 78f493f..2ce9bf7 100644 --- a/composer.json +++ b/composer.json @@ -22,16 +22,16 @@ } ], "require": { - "php": "^8.1", + "php": "^8.3", "league/flysystem": "^3.0", "microsoft/microsoft-graph": "^1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.10.0", - "phpstan/phpstan-deprecation-rules": "^1.0.0", - "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.23", - "symfony/var-dumper": "^6.1" + "friendsofphp/php-cs-fixer": "^3.69.0", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "phpstan/phpstan": "^1.12.18", + "phpunit/phpunit": "^9.6.22", + "symfony/var-dumper": "^7.2" }, "scripts": { "ci": [ @@ -39,8 +39,8 @@ "@phpstan", "vendor/bin/phpunit --colors=auto" ], - "cs:dry": "php-cs-fixer fix --diff --dry-run --no-interaction --ansi", - "cs:fix": "php-cs-fixer fix --ansi", + "cs:dry": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run --no-interaction --ansi", + "cs:fix": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --ansi", "phpstan": "vendor/bin/phpstan analyse --ansi" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ac12b6a..9b16f98 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ - + ./tests/ From fb72ac42e008fb6f7a4cd3924dd2b81d810bb71c Mon Sep 17 00:00:00 2001 From: jmsche Date: Tue, 18 Feb 2025 17:54:02 +0100 Subject: [PATCH 2/5] Upgrade PHPUnit to v12 --- composer.json | 2 +- phpunit.xml.dist | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 2ce9bf7..cf972a7 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "friendsofphp/php-cs-fixer": "^3.69.0", "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan": "^1.12.18", - "phpunit/phpunit": "^9.6.22", + "phpunit/phpunit": "^12.0.3", "symfony/var-dumper": "^7.2" }, "scripts": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9b16f98..b0f8617 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,14 +7,15 @@ - + + + ./ ./tests ./vendor - ./.php-cs-fixer.dist.php - + From 86e44a8291188f348b3a3e1cd13e1be4a9d0bc19 Mon Sep 17 00:00:00 2001 From: jmsche Date: Tue, 18 Feb 2025 17:58:14 +0100 Subject: [PATCH 3/5] Update .gitattributes --- .gitattributes | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.gitattributes b/.gitattributes index bb6265e..2f843b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,7 @@ -# Path-based git attributes -# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html - -# Ignore all test and documentation with "export-ignore". -/.gitattributes export-ignore -/.gitignore export-ignore -/.travis.yml export-ignore -/phpunit.xml.dist export-ignore -/.scrutinizer.yml export-ignore -/tests export-ignore -/.editorconfig export-ignore +/.github export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.dist.php export-ignore +/phpstan.neon.dist export-ignore +/phpunit.xml.dist export-ignore From a3ad7ec3ab565e6d21b16c2949c3ed427879f173 Mon Sep 17 00:00:00 2001 From: jmsche Date: Tue, 18 Feb 2025 17:58:20 +0100 Subject: [PATCH 4/5] Upgrade PHPStan to v2 --- composer.json | 4 ++-- phpstan.neon.dist | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index cf972a7..9620ed0 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,8 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.69.0", - "phpstan/phpstan-deprecation-rules": "^1.2.1", - "phpstan/phpstan": "^1.12.18", + "phpstan/phpstan-deprecation-rules": "^2.0.1", + "phpstan/phpstan": "^2.1.5", "phpunit/phpunit": "^12.0.3", "symfony/var-dumper": "^7.2" }, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f3c9b51..80ee68f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ includes: - - vendor/phpstan/phpstan/conf/bleedingEdge.neon + - phar://phpstan.phar/conf/bleedingEdge.neon - vendor/phpstan/phpstan-deprecation-rules/rules.neon parameters: From 379c653dbe5480ac12906cf7596cd81b2e1f686a Mon Sep 17 00:00:00 2001 From: jmsche Date: Tue, 18 Feb 2025 18:02:30 +0100 Subject: [PATCH 5/5] Upgrade PHPStan to level 6 --- phpstan.neon.dist | 2 +- src/OneDriveAdapter.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 80ee68f..4652c16 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -6,4 +6,4 @@ parameters: paths: - src - tests - level: 5 + level: 6 diff --git a/src/OneDriveAdapter.php b/src/OneDriveAdapter.php index 292fe37..707fe4b 100644 --- a/src/OneDriveAdapter.php +++ b/src/OneDriveAdapter.php @@ -271,7 +271,10 @@ private function applyPathPrefix(string $path): string return '/' . trim($this->prefixer->prefixPath($path), '/'); } - private function upload(string $path, $contents) + /** + * @param string|resource $contents + */ + private function upload(string $path, $contents): void { $filename = basename($path); $path = $this->applyPathPrefix($path); @@ -340,6 +343,9 @@ private function getMetadata(string $path): OneDriveMetadata ); } + /** + * @param array $response + */ private function normalizeResponse(array $response, string $path): StorageAttributes { $path = str_replace('root/children', 'root:/children', $path);