Skip to content

Raise minimum PHP version to 8.2#1546

Merged
jtojnar merged 10 commits intomasterfrom
php82
Dec 24, 2025
Merged

Raise minimum PHP version to 8.2#1546
jtojnar merged 10 commits intomasterfrom
php82

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Dec 24, 2025

We want to use Tracy debugger, which requires PHP 8.2.

This will also allow us to use enumerations, readonly properties, fibers, never return type and first-class callable syntax, among other things.

https://www.php.net/releases/8_1_0.php

And while we usually follow Debian PHP support, we already dropped Debian 11 Bullseye early in 0932317.
Debian 12 Bookworm contains PHP 8.2.
https://www.debian.org/releases/
https://wiki.debian.org/PHP

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for selfoss ready!

Name Link
🔨 Latest commit c41a567
🔍 Latest deploy log https://app.netlify.com/projects/selfoss/deploys/694c6360b0222a000884e2be
😎 Deploy Preview https://deploy-preview-1546--selfoss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

So that we do not have to do the bump at the same time minimum version is raised.
We want to use Tracy debugger, which requires PHP 8.2.

This will also allow us to use enumerations, readonly properties, fibers, never return type and first-class callable syntax, among other things.

https://www.php.net/releases/8_1_0.php

And while we usually follow Debian PHP support, we already dropped Debian 11 Bullseye early in 0932317.
Debian 12 Bookworm contains PHP 8.2.
https://www.debian.org/releases/
https://wiki.debian.org/PHP

But let’s upgrade gradually.
Introduced in PHP 8.1:
https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.callable-syntax

Performed using the following Rector rules:

- Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector
- Rector\CodingStyle\Rector\FuncCall\ClosureFromCallableToFirstClassCallableRector
- Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector
- Rector\CodingStyle\Rector\Closure\ClosureDelegatingCallToFirstClassCallableRector
- Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector
Changelogs summary:

 - symfony/deprecation-contracts updated from v3.0.2 to v3.6.0 minor
   See changes: symfony/deprecation-contracts@v3.0.2...v3.6.0
   Release notes: https://github.com/symfony/deprecation-contracts/releases/tag/v3.6.0

 - symfony/options-resolver updated from v6.0.19 to v6.4.30 minor
   See changes: symfony/options-resolver@v6.0.19...v6.4.30
   Release notes: https://github.com/symfony/options-resolver/releases/tag/v6.4.30

 - symfony/finder updated from v6.0.19 to v6.4.27 minor
   See changes: symfony/finder@v6.0.19...v6.4.27
   Release notes: https://github.com/symfony/finder/releases/tag/v6.4.27

 - symfony/var-exporter updated from v6.0.19 to v6.4.26 minor
   See changes: symfony/var-exporter@v6.0.19...v6.4.26
   Release notes: https://github.com/symfony/var-exporter/releases/tag/v6.4.26

 - symfony/service-contracts updated from v3.0.2 to v3.6.1 minor
   See changes: symfony/service-contracts@v3.0.2...v3.6.1
   Release notes: https://github.com/symfony/service-contracts/releases/tag/v3.6.1

 - symfony/cache-contracts updated from v3.0.2 to v3.6.0 minor
   See changes: symfony/cache-contracts@v3.0.2...v3.6.0
   Release notes: https://github.com/symfony/cache-contracts/releases/tag/v3.6.0

 - symfony/cache updated from v6.0.19 to v6.4.30 minor
   See changes: symfony/cache@v6.0.19...v6.4.30
   Release notes: https://github.com/symfony/cache/releases/tag/v6.4.30

 - symfony/phpunit-bridge updated from v7.3.4 to v7.4.0 minor
   See changes: symfony/phpunit-bridge@v7.3.4...v7.4.0
   Release notes: https://github.com/symfony/phpunit-bridge/releases/tag/v7.4.0

  - symfony/phpunit-bridge updated from v7.4.0 to v8.0.0 major
   See changes: symfony/phpunit-bridge@v7.4.0...v8.0.0
   Release notes: https://github.com/symfony/phpunit-bridge/releases/tag/v8.0.0
We want to use Tracy debugger.

This will also allow us to use readonly classes, among other things.

https://www.php.net/releases/8_2_0.php

And while we usually follow Debian PHP support, we already dropped Debian 11 Bullseye early in 0932317.
Debian 12 Bookworm contains PHP 8.2.
https://www.debian.org/releases/
https://wiki.debian.org/PHP
Changelogs summary:

 - symfony/options-resolver updated from v6.4.30 to v7.4.0 major
   See changes: symfony/options-resolver@v6.4.30...v7.4.0
   Release notes: https://github.com/symfony/options-resolver/releases/tag/v7.4.0

 - symfony/finder updated from v6.4.27 to v7.4.0 major
   See changes: symfony/finder@v6.4.27...v7.4.0
   Release notes: https://github.com/symfony/finder/releases/tag/v7.4.0

 - symfony/var-exporter updated from v6.4.26 to v7.4.0 major
   See changes: symfony/var-exporter@v6.4.26...v7.4.0
   Release notes: https://github.com/symfony/var-exporter/releases/tag/v7.4.0

 - symfony/cache updated from v6.4.30 to v7.4.1 major
   See changes: symfony/cache@v6.4.30...v7.4.1
   Release notes: https://github.com/symfony/cache/releases/tag/v7.4.1
These would be changed by `Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector` after I mark the classes `final`.

Without `final`, Rector considers `void` intentional:

https://github.com/rectorphp/rector/blob/d0924cecd248c43fe2726fb4b8fb85a9ff18037e/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php#L87-L88
Composition over inheritance as a best practice we should strive to follow:
https://en.wikipedia.org/wiki/Composition_over_inheritance

It should be fine to do this for controllers and daos since those are entirely internal. There is a slight chance that someone is extending one of the helpers in their spouts but I have not seen that on GitHub so I consider disallowing that acceptable.

We will still keep the following non-final:
- `daos\mysql\{Items,Sources,Statements,Tags}` because we were too lazy to follow the best practice there.
- `helpers\WebClient` because we mock it in tests.
- `spouts\spout` and its children because it would be too much of a BC break.

Let’s use search and replace and manually skip those that we do not want to finalize.
Using `Rector\Php81\Rector\Property\ReadOnlyPropertyRector` and `Rector\Php82\Rector\Class_\ReadOnlyClassRector`.

All controllers should be readonly. `Tags` and `Opml\Import` are an exception, for now, as they are doing weird stateful things.

Ideally, spouts and helpers would be too but there are some backwards compatibility concerns.
@jtojnar jtojnar added this to the 2.20 milestone Dec 24, 2025
@jtojnar jtojnar merged commit c41a567 into master Dec 24, 2025
12 checks passed
@jtojnar jtojnar deleted the php82 branch December 24, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant