Commit 628ac31
committed
Fix PHP 8.4 compatibility / drop support for PHP < 7.1
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameter with a `null` default value, which are not explicitly declared as nullable.
Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
There are multiple ways to fix this, though most involve breaking changes:
1. Remove the type declaration and do in-method type validation.
As this is not a `final` class, nor are these `final` or `private` methods, this would be a breaking change for any class extending the `Parser` class as parameter types are contra-variant, so this would cause a signature mismatch.
2. Remove the `null` default value.
This, again, would be a breaking change and an even bigger one as it turns an optional parameter into a required one, so this wouldn't just have an impact on overloaded methods, but on all _calls_ to the methods too.
3. Declare the parameters as nullable.
This would not cause a signature mismatch.
This is the change with the least impact, although it does require PHP 7.1. If this is released as a next _minor_ though, the impact will be minimal as Composer can handle the version negotiations and will just install an older version for PHP 5.6/7.0.
Also note that based on the Packagist stats, this version negotiation would rarely be needed as the users of this package hardly use PHP 5.6/7.0 anymore: https://packagist.org/packages/mf2/mf2/php-stats
With this in mind, I'm proposing dropping support for PHP < 7.1 and fixing the PHP 8.4 deprecations by making the relevant parameters explicitly nullable.
Includes updating CI and the PHPCS config.1 parent af7522b commit 628ac31
File tree
4 files changed
+6
-6
lines changed- .github/workflows
- Mf2
4 files changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
1386 | | - | |
| 1386 | + | |
1387 | 1387 | | |
1388 | 1388 | | |
1389 | 1389 | | |
| |||
1411 | 1411 | | |
1412 | 1412 | | |
1413 | 1413 | | |
1414 | | - | |
| 1414 | + | |
1415 | 1415 | | |
1416 | 1416 | | |
1417 | 1417 | | |
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
1519 | | - | |
| 1519 | + | |
1520 | 1520 | | |
1521 | 1521 | | |
1522 | 1522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
0 commit comments