From 0f72389a4835e0c0af0701c431e85390dcf73b92 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Fri, 22 Nov 2024 09:46:46 +0100 Subject: [PATCH 1/6] Run inspections on 8.3 and 8.4 Now that PHP 8.4 has officially been released the inspections can be run on PHP version 8.3 and 8.4 as well. --- .github/workflows/pull_request.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index cfc9422..9488f00 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.0', '8.1', '8.2'] + php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php-versions }} steps: diff --git a/composer.json b/composer.json index c79ea84..e9d55d1 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "license": "Apache-2.0", "require": { - "php": "^8.0, <8.3", + "php": "^8.0, <8.5", "symfony/console": "^6.0", "timoschinkel/codeowners": "^2.0", "symfony/finder": "^6.0" From ef0890e05e066c01468120e21b131e2c1a0c5861 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Fri, 22 Nov 2024 10:15:19 +0100 Subject: [PATCH 2/6] Update dependencies --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e9d55d1..e26185c 100755 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.2", + "vimeo/psalm": "^5.26", "phpunit/phpunit": "^9.4", "mikey179/vfsstream": "^1.6", "phpspec/prophecy-phpunit": "^2.0" From 00fb49663879f452bf1fd6e067e5fa78e1dc3e53 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Fri, 22 Nov 2024 10:23:56 +0100 Subject: [PATCH 3/6] Fix issues reported by Psalm Most notably about strict comparisons: https://psalm.dev/356 --- src/Command/ListFilesCommand.php | 2 +- src/Command/ListUnownedFilesCommand.php | 2 +- src/FileLocator/FileLocatorFactory.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/ListFilesCommand.php b/src/Command/ListFilesCommand.php index 40c2d76..bbf5a15 100644 --- a/src/Command/ListFilesCommand.php +++ b/src/Command/ListFilesCommand.php @@ -116,7 +116,7 @@ private function normalizePaths(array $paths): array // not support `realpath`. return array_map( function (string $path): string { - return realpath($path) ?: $path; + return realpath($path) !== false ? realpath($path) : $path; }, $paths ); diff --git a/src/Command/ListUnownedFilesCommand.php b/src/Command/ListUnownedFilesCommand.php index 1ac918b..1cd5e20 100644 --- a/src/Command/ListUnownedFilesCommand.php +++ b/src/Command/ListUnownedFilesCommand.php @@ -106,7 +106,7 @@ private function normalizePaths(array $paths): array // not support `realpath`. return array_map( function (string $path): string { - return realpath($path) ?: $path; + return realpath($path) !== false ? realpath($path) : $path; }, $paths ); diff --git a/src/FileLocator/FileLocatorFactory.php b/src/FileLocator/FileLocatorFactory.php index a52eb96..f17ecf1 100644 --- a/src/FileLocator/FileLocatorFactory.php +++ b/src/FileLocator/FileLocatorFactory.php @@ -8,7 +8,7 @@ final class FileLocatorFactory implements FileLocatorFactoryInterface { public function getFileLocator(string $workingDirectory, string $specifiedFile = null): FileLocatorInterface { - return empty($specifiedFile) === false + return $specifiedFile !== null ? new SpecifiedFileLocator($specifiedFile) : new SearchFileLocator($workingDirectory); } From c8e18f34ec488fb59d6d2926f556c50fb0ef2e10 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Wed, 29 Jan 2025 10:51:09 +0100 Subject: [PATCH 4/6] Change PHP requirement to `^8.0` I am optimistic, so I will remove the blocking of non-released PHP versions. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e26185c..f190f46 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "license": "Apache-2.0", "require": { - "php": "^8.0, <8.5", + "php": "^8.0", "symfony/console": "^6.0", "timoschinkel/codeowners": "^2.0", "symfony/finder": "^6.0" From e8627214041f0c7f133b37bc38cd4cb54a4d376e Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Wed, 29 Jan 2025 10:56:55 +0100 Subject: [PATCH 5/6] Update Psalm to version 6 - Update Psalm to version 6 to get PHP 8.4 support - `composer require --dev vimeo/psalm:^6.0 -W` - Suppress `UnusedClass` inspection as Psalm does not appear to understand when the classes are used in `bin/codeowners` - Assign result of `realpath()` to a variable to let Psalm understand that we actually check against the `false` return value --- composer.json | 2 +- psalm.xml | 2 ++ src/Command/ListFilesCommand.php | 3 ++- src/Command/ListUnownedFilesCommand.php | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f190f46..bf9deea 100755 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^5.26", + "vimeo/psalm": "^6.0", "phpunit/phpunit": "^9.4", "mikey179/vfsstream": "^1.6", "phpspec/prophecy-phpunit": "^2.0" diff --git a/psalm.xml b/psalm.xml index 4e4c4f6..9d917d4 100644 --- a/psalm.xml +++ b/psalm.xml @@ -49,5 +49,7 @@ + + diff --git a/src/Command/ListFilesCommand.php b/src/Command/ListFilesCommand.php index bbf5a15..06e310e 100644 --- a/src/Command/ListFilesCommand.php +++ b/src/Command/ListFilesCommand.php @@ -116,7 +116,8 @@ private function normalizePaths(array $paths): array // not support `realpath`. return array_map( function (string $path): string { - return realpath($path) !== false ? realpath($path) : $path; + $realpath = realpath($path); + return $realpath !== false ? $realpath : $path; }, $paths ); diff --git a/src/Command/ListUnownedFilesCommand.php b/src/Command/ListUnownedFilesCommand.php index 1cd5e20..36b25ba 100644 --- a/src/Command/ListUnownedFilesCommand.php +++ b/src/Command/ListUnownedFilesCommand.php @@ -106,7 +106,8 @@ private function normalizePaths(array $paths): array // not support `realpath`. return array_map( function (string $path): string { - return realpath($path) !== false ? realpath($path) : $path; + $realpath = realpath($path); + return $realpath !== false ? $realpath : $path; }, $paths ); From d85b3d66d7f2f9ad37e82b9265b7d5a229828533 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Wed, 29 Jan 2025 11:03:17 +0100 Subject: [PATCH 6/6] Update supported PHP versions - Remove support for PHP 8.0 - it is no longer in active support, and for those that are still running this version you will be able to use version up until 1.4.0 - Added inspections - and thus support - for PHP 8.3 and PHP 8.4 --- .github/workflows/pull_request.yml | 2 +- CHANGELOG.md | 7 +++++++ composer.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9488f00..e5abf8e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php-versions }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 388323a..fb9616f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.1] - 2025-01-29 +### Removed +- Dropped support for PHP 8.0 + +### Added +- Inspections - and thus support - for PHP 8.3 and 8.4 + ## [1.4.0] - 2022-12-09 ### Added - Version output to `codeowners --version` diff --git a/composer.json b/composer.json index bf9deea..8195ce8 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "license": "Apache-2.0", "require": { - "php": "^8.0", + "php": "^8.1", "symfony/console": "^6.0", "timoschinkel/codeowners": "^2.0", "symfony/finder": "^6.0"