From 76ba2387c42f885f737a30326ba751f9a84acab5 Mon Sep 17 00:00:00 2001 From: Exanlv Date: Tue, 10 Mar 2026 22:18:17 +0100 Subject: [PATCH 1/8] Bump minimum php version to 8.4 --- .dev/docker/php/8.5/Dockerfile | 13 +++++++++++++ .github/workflows/code-quality.yml | 8 ++++---- .github/workflows/unit-tests.yml | 2 +- composer.json | 10 ++++------ docker-compose.yml | 12 ++++++++++++ readme.md | 2 +- 6 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 .dev/docker/php/8.5/Dockerfile diff --git a/.dev/docker/php/8.5/Dockerfile b/.dev/docker/php/8.5/Dockerfile new file mode 100644 index 0000000..53f9a8b --- /dev/null +++ b/.dev/docker/php/8.5/Dockerfile @@ -0,0 +1,13 @@ +FROM php:8.5-cli-alpine AS lyngvi-php + +RUN apk add --update linux-headers + +RUN apk add --no-cache pcre ${PHPIZE_DEPS} \ + libevent-dev openssl openssl-dev + +RUN pecl install ev xdebug + +RUN docker-php-ext-enable ev xdebug + +RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer -O - -q | php -- --quiet +RUN mv /composer.phar /usr/local/bin/composer diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 44b7378..d06b8e4 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - - name: Install PHP 8.1 + - name: Install PHP 8.4 uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 - name: Install packages run: composer install --no-progress - name: Run CS @@ -25,10 +25,10 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - - name: Install PHP 8.1 + - name: Install PHP 8.4 uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 - name: Install packages run: composer install --no-progress - name: Run MD diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2feff64..088ad01 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.2', '8.3', '8.4' ] + php: [ '8.4', '8.5' ] steps: - uses: actions/checkout@v3 diff --git a/composer.json b/composer.json index ea21e06..806f483 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "minimum-stability": "stable", "require": { - "php": "^8.2", + "php": "^8.4", "react/event-loop": "^1.3.0", "evenement/evenement": "^3.0.0", "nesbot/carbon": "^2.64 || ^3.0", @@ -47,13 +47,11 @@ "test": "phpunit", "test-coverage": "@php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-html .phpunit.cache/cov-html", - "test-8.2": "docker-compose run php8.2 composer test", - "test-8.3": "docker-compose run php8.3 composer test", "test-8.4": "docker-compose run php8.4 composer test", + "test-8.5": "docker-compose run php8.4 composer test", "test-all": [ - "composer test-8.2", - "composer test-8.3", - "composer test-8.4" + "composer test-8.4", + "composer test-8.5" ] }, "config": { diff --git a/docker-compose.yml b/docker-compose.yml index 95f85fc..c3ca12d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,10 @@ services: + php8.1: + build: ./.dev/docker/php/8.1 + volumes: + - .:/fenrir:z + working_dir: /fenrir + command: sh php8.2: build: ./.dev/docker/php/8.2 volumes: @@ -17,3 +23,9 @@ services: - .:/fenrir:z working_dir: /fenrir command: sh + php8.5: + build: ./.dev/docker/php/8.5 + volumes: + - .:/fenrir:z + working_dir: /fenrir + command: sh diff --git a/readme.md b/readme.md index ae9780d..b62d9e2 100644 --- a/readme.md +++ b/readme.md @@ -88,7 +88,7 @@ For more examples, check out the examples directory ## Support -Fenrir currently supports PHP 8.2+ +Fenrir currently supports PHP 8.4+ Tests should pass nightly builds of newer versions, but this is not a supported usecase. If you're using this in a Apache2/Nginx/etc webserver environment, you should probably limit yourself to only using Fenrir's REST capabilities. From 180c4cb0515c6301934d9690c52d8ed4ed1cedaa Mon Sep 17 00:00:00 2001 From: Exanlv Date: Tue, 10 Mar 2026 22:21:01 +0100 Subject: [PATCH 2/8] Add 8.6 unit tests --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 088ad01..4e2698e 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.4', '8.5' ] + php: [ '8.4', '8.5', '8.6' ] steps: - uses: actions/checkout@v3 From c39d9da7af58ace6ec37ce907bd45b99e7895844 Mon Sep 17 00:00:00 2001 From: Exanlv Date: Thu, 12 Mar 2026 12:28:33 +0100 Subject: [PATCH 3/8] Add table with version compatibility --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index b62d9e2..faa617f 100644 --- a/readme.md +++ b/readme.md @@ -91,6 +91,14 @@ For more examples, check out the examples directory Fenrir currently supports PHP 8.4+ Tests should pass nightly builds of newer versions, but this is not a supported usecase. +| PHP Version | Library version | +| ----------- | --------------- | +| 8.4+ | Current | +| 8.2, 8.3 | < 1.2 | +| 8.1 | < 1.0.1 | + +Note: Bugfixes/features will not be backported to older versions. Older versions are as-is. + If you're using this in a Apache2/Nginx/etc webserver environment, you should probably limit yourself to only using Fenrir's REST capabilities. These environments typically don't allow long-running processes. From e80034f6bcd6e5c1d92c5bdbad888faa524b910c Mon Sep 17 00:00:00 2001 From: Exanlv Date: Sat, 11 Apr 2026 11:08:04 +0200 Subject: [PATCH 4/8] Bump to 8.5 --- .github/workflows/code-quality.yml | 8 ++++---- .github/workflows/unit-tests.yml | 2 +- composer.json | 6 ++---- readme.md | 10 +++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index d06b8e4..43393ad 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - - name: Install PHP 8.4 + - name: Install PHP 8.5 uses: shivammathur/setup-php@v2 with: - php-version: 8.4 + php-version: 8.5 - name: Install packages run: composer install --no-progress - name: Run CS @@ -25,10 +25,10 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - - name: Install PHP 8.4 + - name: Install PHP 8.5 uses: shivammathur/setup-php@v2 with: - php-version: 8.4 + php-version: 8.5 - name: Install packages run: composer install --no-progress - name: Run MD diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4e2698e..f474e04 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.4', '8.5', '8.6' ] + php: [ '8.5', '8.6' ] steps: - uses: actions/checkout@v3 diff --git a/composer.json b/composer.json index 806f483..7f94cc4 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "minimum-stability": "stable", "require": { - "php": "^8.4", + "php": "^8.5", "react/event-loop": "^1.3.0", "evenement/evenement": "^3.0.0", "nesbot/carbon": "^2.64 || ^3.0", @@ -47,10 +47,8 @@ "test": "phpunit", "test-coverage": "@php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-html .phpunit.cache/cov-html", - "test-8.4": "docker-compose run php8.4 composer test", - "test-8.5": "docker-compose run php8.4 composer test", + "test-8.5": "docker-compose run php8.5 composer test", "test-all": [ - "composer test-8.4", "composer test-8.5" ] }, diff --git a/readme.md b/readme.md index faa617f..1b85270 100644 --- a/readme.md +++ b/readme.md @@ -91,11 +91,11 @@ For more examples, check out the examples directory Fenrir currently supports PHP 8.4+ Tests should pass nightly builds of newer versions, but this is not a supported usecase. -| PHP Version | Library version | -| ----------- | --------------- | -| 8.4+ | Current | -| 8.2, 8.3 | < 1.2 | -| 8.1 | < 1.0.1 | +| PHP Version | Library version | +| ------------- | --------------- | +| 8.5+ | Current | +| 8.2, 8.3, 8.4 | < 1.2 | +| 8.1 | < 1.0.1 | Note: Bugfixes/features will not be backported to older versions. Older versions are as-is. From 359bf3528e44730f8e911464eca8996181b65c6f Mon Sep 17 00:00:00 2001 From: Exanlv Date: Sat, 11 Apr 2026 14:07:49 +0200 Subject: [PATCH 5/8] Remove spatie regex, require carbon 3 --- composer.json | 3 +-- src/Rest/Helpers/Command/CommandBuilder.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 7f94cc4..cbc1d57 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,9 @@ "php": "^8.5", "react/event-loop": "^1.3.0", "evenement/evenement": "^3.0.0", - "nesbot/carbon": "^2.64 || ^3.0", + "nesbot/carbon": "^3.0", "discord-php/http": "^v10.3.0", "ralouphie/mimey": "^1.0", - "spatie/regex": "^3.1", "react/async": "^4.0.0", "exan/eventer": "^1.0.3", "exan/reactphp-retrier": "^2.0", diff --git a/src/Rest/Helpers/Command/CommandBuilder.php b/src/Rest/Helpers/Command/CommandBuilder.php index 8af2059..31f9665 100644 --- a/src/Rest/Helpers/Command/CommandBuilder.php +++ b/src/Rest/Helpers/Command/CommandBuilder.php @@ -11,7 +11,6 @@ use Ragnarok\Fenrir\Enums\InteractionContextType; use Ragnarok\Fenrir\Exceptions\Rest\Helpers\Command\InvalidCommandNameException; use Ragnarok\Fenrir\Rest\Helpers\GetNew; -use Spatie\Regex\Regex; class CommandBuilder { @@ -214,7 +213,7 @@ public function getContexts(): ?array private function isAllowedName($name): bool { - return Regex::match(Command::NAME_REGEX, $name)->hasMatch(); + return preg_match(Command::NAME_REGEX, $name) === 1; } public function get(): array From 85bae0137016ba8a143ef8bac6fda5432dac956c Mon Sep 17 00:00:00 2001 From: Exanlv Date: Sat, 11 Apr 2026 14:10:23 +0200 Subject: [PATCH 6/8] Remove phpmd --- .github/workflows/code-quality.yml | 13 ------------ composer.json | 3 --- ruleset.xml | 32 ------------------------------ src/Gateway/Connection.php | 3 --- src/Rest/Channel.php | 3 --- src/Rest/Guild.php | 5 ----- src/Rest/HttpResource.php | 4 ---- src/Rest/Rest.php | 3 --- src/Rest/Webhook.php | 1 - 9 files changed, 67 deletions(-) delete mode 100644 ruleset.xml diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 43393ad..636fce3 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -20,16 +20,3 @@ jobs: run: composer cs - name: Verify namespaces run: bash util/verify-namespacing.sh - - phpmd: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v3 - - name: Install PHP 8.5 - uses: shivammathur/setup-php@v2 - with: - php-version: 8.5 - - name: Install packages - run: composer install --no-progress - - name: Run MD - run: composer md diff --git a/composer.json b/composer.json index cbc1d57..d06821a 100644 --- a/composer.json +++ b/composer.json @@ -32,14 +32,11 @@ "require-dev": { "monolog/monolog": "^3.2", "phpunit/phpunit": "^9.5 || ^10.0", - "phpmd/phpmd": "^2.13", "symfony/var-dumper": "^6.2 || ^7.0", "mockery/mockery": "^1.6", "friendsofphp/php-cs-fixer": "^3.20" }, "scripts": { - "md": "phpmd src text ruleset.xml", - "cs": "php-cs-fixer fix --using-cache=no --diff --dry-run --allow-risky=yes", "csf": "php-cs-fixer fix --using-cache=no --allow-risky=yes", diff --git a/ruleset.xml b/ruleset.xml deleted file mode 100644 index e4a43c7..0000000 --- a/ruleset.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - PHPMD ruleset for Fenrir - - - src/Parts/* - src/Gateway/Events/* - src/Websocket/Objects/* - - - - - - - - - - - - - - - - - - - diff --git a/src/Gateway/Connection.php b/src/Gateway/Connection.php index 745c9cc..692e43f 100644 --- a/src/Gateway/Connection.php +++ b/src/Gateway/Connection.php @@ -31,9 +31,6 @@ use React\EventLoop\TimerInterface; use React\Promise\PromiseInterface; -/** - * @SuppressWarnings(PHPMD.TooManyPublicMethods) - */ class Connection implements ConnectionInterface { public const DISCORD_VERSION = 10; diff --git a/src/Rest/Channel.php b/src/Rest/Channel.php index bfec86e..bd48e07 100644 --- a/src/Rest/Channel.php +++ b/src/Rest/Channel.php @@ -26,9 +26,6 @@ /** * @see https://discord.com/developers/docs/resources/channel * - * @SuppressWarnings(PHPMD.TooManyMethods) - * @SuppressWarnings(PHPMD.TooManyPublicMethods) - * * @todo seperate calls, `$this->reaction->create(...)` instead of `$this->createReaction(...)` etc */ class Channel extends HttpResource diff --git a/src/Rest/Guild.php b/src/Rest/Guild.php index a07e3cd..34886b5 100644 --- a/src/Rest/Guild.php +++ b/src/Rest/Guild.php @@ -26,11 +26,6 @@ /** * @see https://discord.com/developers/docs/resources/guild - * - * @SuppressWarnings(PHPMD.TooManyMethods) - * @SuppressWarnings(PHPMD.TooManyPublicMethods) - * @SuppressWarnings(PHPMD.ExcessivePublicCount) - * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ class Guild extends HttpResource { diff --git a/src/Rest/HttpResource.php b/src/Rest/HttpResource.php index ad99521..df183a4 100644 --- a/src/Rest/HttpResource.php +++ b/src/Rest/HttpResource.php @@ -8,11 +8,7 @@ use Psr\Log\LoggerInterface; use Ragnarok\Fenrir\DataMapper; use React\Promise\PromiseInterface; -use Throwable; -/** - * @SuppressWarnings(PHPMD.NumberOfChildren) - */ abstract class HttpResource { public function __construct( diff --git a/src/Rest/Rest.php b/src/Rest/Rest.php index 1278594..71c7537 100644 --- a/src/Rest/Rest.php +++ b/src/Rest/Rest.php @@ -8,9 +8,6 @@ use Psr\Log\LoggerInterface; use Ragnarok\Fenrir\DataMapper; -/** - * @SuppressWarnings(PHPMD.TooManyFields) - */ class Rest { public readonly Application $application; diff --git a/src/Rest/Webhook.php b/src/Rest/Webhook.php index 283e6ea..25bf6da 100644 --- a/src/Rest/Webhook.php +++ b/src/Rest/Webhook.php @@ -17,7 +17,6 @@ /** * @see https://discord.com/developers/docs/resources/webhook - * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ class Webhook extends HttpResource { From 7591de78cbaf8a96ad8bd1dd32a1de21d786d53b Mon Sep 17 00:00:00 2001 From: Exanlv Date: Sat, 11 Apr 2026 14:16:53 +0200 Subject: [PATCH 7/8] Remove freezemage0/array_find as this is native since 8.4 --- composer.json | 1 - src/Command/CommandExtension.php | 4 +--- src/Interaction/CommandInteraction.php | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/composer.json b/composer.json index d06821a..d1f9cc1 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "react/async": "^4.0.0", "exan/eventer": "^1.0.3", "exan/reactphp-retrier": "^2.0", - "freezemage0/array_find": "^1.0", "react/promise": "^3", "ratchet/pawl": "^0.4.3" }, diff --git a/src/Command/CommandExtension.php b/src/Command/CommandExtension.php index b7de44a..082fe55 100644 --- a/src/Command/CommandExtension.php +++ b/src/Command/CommandExtension.php @@ -15,8 +15,6 @@ use Ragnarok\Fenrir\Interaction\CommandInteraction; use Ragnarok\Fenrir\Parts\ApplicationCommandInteractionDataOptionStructure; -use function Freezemage\ArrayUtils\find; - abstract class CommandExtension extends EventEmitter implements Extension { protected FilteredEventEmitter $commandListener; @@ -61,7 +59,7 @@ protected function getFullNameByInteraction(InteractionCreate $command): string private function drillName(array $options, array &$names) { /** @var ?ApplicationCommandInteractionDataOptionStructure */ - $subCommand = find($options ?? [], function (ApplicationCommandInteractionDataOptionStructure $option) { + $subCommand = array_find($options ?? [], function (ApplicationCommandInteractionDataOptionStructure $option) { return in_array( $option->type, [ diff --git a/src/Interaction/CommandInteraction.php b/src/Interaction/CommandInteraction.php index eee67e2..3011c50 100644 --- a/src/Interaction/CommandInteraction.php +++ b/src/Interaction/CommandInteraction.php @@ -12,8 +12,6 @@ use Ragnarok\Fenrir\Rest\Helpers\Webhook\EditWebhookBuilder; use React\Promise\PromiseInterface; -use function Freezemage\ArrayUtils\find as array_find; - class CommandInteraction { /** @var OptionStructure[] */ From 15f17e4d4e13a9744fbc8a77751c3cd7edff02e0 Mon Sep 17 00:00:00 2001 From: Exanlv Date: Sat, 11 Apr 2026 14:20:28 +0200 Subject: [PATCH 8/8] Change ubunto 24.04 to latest --- .github/workflows/code-quality.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 636fce3..2f8f4e4 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -7,7 +7,7 @@ on: jobs: cs: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install PHP 8.5 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f474e04..7374725 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -8,7 +8,7 @@ on: jobs: tests: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest strategy: fail-fast: false