- Issue created by @Ayesh
- Merge request !7048Issue #3427999: [PHP 8.4] Fix implicitly nullable type declarations → (Open) created by Ayesh
- 🇺🇸United States mfb San Francisco
Ideally the phpdoc could stay in sync with the code?
e.g.
* @param array $ids * An array of entity IDs, or NULL to load all entities. * * @return static[] * An array of entity objects indexed by their IDs. */ public static function loadMultiple(array $ids = NULL);
becomes
* @param ?array $ids * An array of entity IDs, or NULL to load all entities. * * @return static[] * An array of entity objects indexed by their IDs. */ public static function loadMultiple(?array $ids = NULL);
- 🇮🇹Italy mondrake 🇮🇹
Ideally should be solved before D11, since it has BC implications
- 🇫🇷France andypost
First core run on 8.4 showed that we need to wait contrib fixes #3427903-3: [META] Make Drupal 10.3/11 compatible with PHP 8.4 →
- last update
8 months ago run-tests.sh exception - 🇫🇷France andypost
It affects in D10
hook_entity_field_access()
- function rest_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) { + function rest_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
- 🇫🇷France andypost
Got a first with all deprecations filed (the failures are unrelated to the issue) https://git.drupalcode.org/issue/drupal-3427903/-/jobs/1459523
- 🇫🇷France andypost
Filed first child issue 📌 [8.4] Fix implicitly nullable type declarations in composer Needs review
- Merge request !8004Apply SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue #3427999 → (Closed) created by andypost
- 🇫🇷France andypost
There's
SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue
sniffer to catch such issues - 🇫🇷France andypost
Discussed in slack with @catch and @smushgrave and decided to not split automated fixes
The issue is postponed follow-up 📌 [8.4] Fix implicitly nullable type declarations in docblocks Postponed
That's because docblocks are not yet covered with sniffer #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard → - 🇸🇰Slovakia poker10
D7 also needs fix
Actually, as D7 still has to support PHP 5.6 and PHP 7.0, we would probably need to drop type declarations where needed and add type checks to the functions itself, see: https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullabl...
Because nullable types were added only in PHP 7.1.
But thanks for the initial research. I will create a separate issues for D7 soon.
- 🇫🇷France andypost
There's also rector rule https://github.com/rectorphp/rector-src/commit/ff32c0c08a89f27ea34187d00... since 1.0.4
- 🇫🇷France andypost
andypost → changed the visibility of the branch 3427999-php-8.4-fix to hidden.
- Status changed to Needs review
7 months ago 11:53pm 20 May 2024 - 🇫🇷France andypost
Re-rolled and re-based https://git.drupalcode.org/project/drupal/-/merge_requests/8004 as reproducible set of commits
PS: Draft MR !7976 is just a attempt to run current state on PHP 8.4
- 🇳🇱Netherlands bbrala Netherlands
Seems you already mentioned the rector rule, awesome.
Think i might need to add that to drupal-rector, since it is a deprecation for 11, and its shouldn't break earlier code afaik.
- Status changed to RTBC
7 months ago 2:25pm 24 May 2024 - 🇺🇸United States smustgrave
Reviewing MR 8004 and see there is a 1 to 1 deletion to addition. One extra addition being phpcs.dist
Spot checking the files and nothing seemed super off based on our slack conversation.
- Status changed to Needs work
7 months ago 7:49am 1 June 2024 - Status changed to Needs review
7 months ago 8:24am 1 June 2024 - Status changed to RTBC
7 months ago 9:04am 1 June 2024 - Status changed to Downport
7 months ago 9:19am 1 June 2024 - 🇬🇧United Kingdom catch
Committed/pushed to 11.x and cherry-picked to 11.0.x, thanks!
We also need an MR for 10.4.x/10.3.x. I don't see any bc implication here because PHP treats these the same in terms of inheritance.
- Merge request !8266[10.4] Apply SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue #3427999 → (Closed) created by andypost
- Status changed to Needs review
7 months ago 3:10pm 1 June 2024 - 🇫🇷France andypost
Created MR for 10.4/10.3 there's extra files but sniffer and `phpcbf` produce reproducible result
- Status changed to RTBC
7 months ago 1:27pm 3 June 2024 - Status changed to Fixed
7 months ago 3:56pm 3 June 2024 - 🇬🇧United Kingdom catch
Committed/pushed to 10.4.x and cherry-picked to 10.3.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.