From 10986d207f84791edb2cf49af4982d222b84a420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 4 Dec 2024 16:10:35 +0100 Subject: [PATCH] upgrade to PHP 8.3 --- .codeclimate.yml | 12 +++---- .github/workflows/continuous-integration.yml | 10 +++--- .php-cs-fixer.php | 6 ++-- codecov.yml | 13 +++++++ composer.json | 10 +++--- phpmd.ruleset.xml | 36 -------------------- phpstan.neon | 4 +-- phpunit.xml | 4 ++- rector.php | 2 +- src/Module.php | 3 ++ src/Router/HostName.php | 5 +++ src/Router/HostNameFactory.php | 2 ++ tests/Router/HostNameFactoryTest.php | 2 ++ 13 files changed, 51 insertions(+), 58 deletions(-) delete mode 100644 phpmd.ruleset.xml diff --git a/.codeclimate.yml b/.codeclimate.yml index caa9009..25d8ed0 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,21 +1,21 @@ version: "2" checks: argument-count: - enabled: true + enabled: false complex-logic: - enabled: true + enabled: false file-lines: enabled: false method-complexity: - enabled: true + enabled: false method-count: - enabled: true + enabled: false method-lines: - enabled: true + enabled: false nested-control-flow: enabled: true return-statements: - enabled: true + enabled: false similar-code: enabled: false identical-code: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d8b9049..a9f51ab 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,7 +19,7 @@ jobs: validate: name: "Validate Project" - uses: "mimmi20/ci/.github/workflows/validate.yml@8.1" + uses: "mimmi20/ci/.github/workflows/validate.yml@8.3" with: extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter" ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0" @@ -37,7 +37,7 @@ jobs: needs: "validate" - uses: "mimmi20/ci/.github/workflows/install.yml@8.1" + uses: "mimmi20/ci/.github/workflows/install.yml@8.3" with: extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter" ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0" @@ -50,7 +50,7 @@ jobs: needs: "install" - uses: "mimmi20/ci/.github/workflows/analytics.yml@8.1" + uses: "mimmi20/ci/.github/workflows/analytics.yml@8.3" with: extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter" ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0" @@ -59,7 +59,7 @@ jobs: skip-phpcs: false skip-phpstan: false skip-rector: false - skip-phpmd: false + skip-phpmd: true skip-eslint: true skip-stylelint: true skip-prettier: true @@ -70,7 +70,7 @@ jobs: needs: "analytics" - uses: "mimmi20/ci/.github/workflows/test.yml@8.1" + uses: "mimmi20/ci/.github/workflows/test.yml@8.3" with: extensions: "ctype, dom, fileinfo, intl, simplexml, tokenizer, xml, xmlwriter" ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0" diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 7c45e17..2dee2a9 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -11,10 +11,12 @@ declare(strict_types = 1); -$header = <<<'EOF' +$year = date('Y'); + +$header = << + Copyright (c) 2021-{$year}, Thomas Mueller For the full copyright and license information, please view the LICENSE file that was distributed with this source code. diff --git a/codecov.yml b/codecov.yml index d964ea3..9c924a4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,6 +3,19 @@ codecov: notify: wait_for_ci: false +coverage: + status: + project: + default: # default is the status check's name, not default settings + target: 100% + threshold: 1% + if_ci_failed: success #success, failure, error, ignore + informational: true + only_pulls: false + patch: + default: + informational: true + comment: layout: "reach, diff, flags, files" behavior: default diff --git a/composer.json b/composer.json index 7a43844..b8c8e17 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "source": "https://github.com/mimmi20/laminas-router-hostname" }, "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0", "ext-mbstring": "*", "laminas/laminas-router": "^3.14.0", "laminas/laminas-stdlib": "^3.20.0", @@ -31,19 +31,19 @@ "ext-xml": "*", "ext-xmlwriter": "*", "infection/infection": "^0.29.8", - "laminas/laminas-http": "^2.20.0", + "laminas/laminas-http": "^2.21.0", "laminas/laminas-modulemanager": "^2.17.0", "laminas/laminas-servicemanager": "^3.22.1", - "mimmi20/coding-standard": "^5.2.45", + "mimmi20/coding-standard": "^6.0.0", "nikic/php-parser": "^5.3.1", "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan": "^1.12.9", "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan-phpunit": "^1.4.0", - "phpunit/phpunit": "^10.5.27", + "phpunit/phpunit": "^11.4.4", "rector/rector": "^1.2.10", "rector/type-perfect": "^1.0.0", - "symfony/process": "^6.4.15", + "symfony/process": "^7.2.0", "symplify/phpstan-rules": "^13.0.1", "tomasvotruba/cognitive-complexity": "^0.2.3", "tomasvotruba/type-coverage": "^1.0.0", diff --git a/phpmd.ruleset.xml b/phpmd.ruleset.xml deleted file mode 100644 index b7ce722..0000000 --- a/phpmd.ruleset.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - The coding standard. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/phpstan.neon b/phpstan.neon index 5d6166d..cc809a2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ parameters: level: max - phpVersion: 80100 # PHP 8.1 + phpVersion: 80300 # PHP 8.3 parallel: maximumNumberOfProcesses: 1 @@ -104,7 +104,7 @@ parameters: return_type: 100 param_type: 77.7 property_type: 100 - constant_type: 0 + constant_type: 100 # also, how many files has declare strict types declare: 100 diff --git a/phpunit.xml b/phpunit.xml index 2e46427..84c0af1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,12 +9,14 @@ beStrictAboutCoverageMetadata="false" beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" + displayDetailsOnPhpunitDeprecations="true" displayDetailsOnTestsThatTriggerWarnings="true" displayDetailsOnTestsThatTriggerNotices="true" displayDetailsOnTestsThatTriggerErrors="true" displayDetailsOnTestsThatTriggerDeprecations="true" displayDetailsOnSkippedTests="true" displayDetailsOnIncompleteTests="true" + failOnPhpunitDeprecation="true" failOnEmptyTestSuite="true" failOnIncomplete="true" failOnRisky="true" @@ -51,7 +53,7 @@ - + diff --git a/rector.php b/rector.php index a09fb6f..29200a1 100644 --- a/rector.php +++ b/rector.php @@ -29,7 +29,7 @@ $rectorConfig->sets([ SetList::DEAD_CODE, - LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_83, PHPUnitSetList::PHPUNIT_100, ]); diff --git a/src/Module.php b/src/Module.php index 55578ca..ed89a34 100644 --- a/src/Module.php +++ b/src/Module.php @@ -15,6 +15,7 @@ use Laminas\ModuleManager\Feature\ConfigProviderInterface; use Laminas\ModuleManager\Feature\DependencyIndicatorInterface; +use Override; final class Module implements ConfigProviderInterface, DependencyIndicatorInterface { @@ -24,6 +25,7 @@ final class Module implements ConfigProviderInterface, DependencyIndicatorInterf * * @throws void */ + #[Override] public function getConfig(): array { $provider = new ConfigProvider(); @@ -41,6 +43,7 @@ public function getConfig(): array * * @throws void */ + #[Override] public function getModuleDependencies(): array { return ['Laminas\Router']; diff --git a/src/Router/HostName.php b/src/Router/HostName.php index f07369e..72725c9 100644 --- a/src/Router/HostName.php +++ b/src/Router/HostName.php @@ -20,6 +20,7 @@ use Laminas\Stdlib\RequestInterface as Request; use Laminas\Uri\Exception\InvalidUriPartException; use Laminas\Uri\Http; +use Override; use Traversable; use function array_key_exists; @@ -76,6 +77,7 @@ public function __construct(private readonly array $hosts = [], private readonly * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint */ + #[Override] public static function factory($options = []): self { if ($options instanceof Traversable) { @@ -125,6 +127,7 @@ public static function factory($options = []): self * * @throws void */ + #[Override] public function match(Request $request): RouteMatch | null { if (!method_exists($request, 'getUri')) { @@ -162,6 +165,7 @@ public function match(Request $request): RouteMatch | null * * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter */ + #[Override] public function assemble(array $params = [], array $options = []): string { $this->assembledParams = []; @@ -215,6 +219,7 @@ public function assemble(array $params = [], array $options = []): string * * @throws void */ + #[Override] public function getAssembledParams(): array { return $this->assembledParams; diff --git a/src/Router/HostNameFactory.php b/src/Router/HostNameFactory.php index 428a0a0..28b50a8 100644 --- a/src/Router/HostNameFactory.php +++ b/src/Router/HostNameFactory.php @@ -16,6 +16,7 @@ use Laminas\Router\Exception\InvalidArgumentException; use Laminas\ServiceManager\Exception\ServiceNotCreatedException; use Laminas\ServiceManager\Factory\FactoryInterface; +use Override; use Psr\Container\ContainerInterface; use function is_array; @@ -32,6 +33,7 @@ final class HostNameFactory implements FactoryInterface * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint */ + #[Override] public function __invoke(ContainerInterface $container, $requestedName, array | null $options = null): HostName { if (!is_array($options)) { diff --git a/tests/Router/HostNameFactoryTest.php b/tests/Router/HostNameFactoryTest.php index c289ef7..89af443 100644 --- a/tests/Router/HostNameFactoryTest.php +++ b/tests/Router/HostNameFactoryTest.php @@ -16,6 +16,7 @@ use Laminas\ServiceManager\Exception\ServiceNotCreatedException; use Mimmi20\Routing\Router\HostName; use Mimmi20\Routing\Router\HostNameFactory; +use Override; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; @@ -27,6 +28,7 @@ final class HostNameFactoryTest extends TestCase private HostNameFactory $object; /** @throws void */ + #[Override] protected function setUp(): void { $this->object = new HostNameFactory();