-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #3260861 by tbsiqueira, navneet0693, apaderno: Add support for php 8.0 #2961
Conversation
06377a4
to
5069aa6
Compare
modules/custom/improved_theme_settings/improved_theme_settings.module
Outdated
Show resolved
Hide resolved
modules/custom/social_ajax_comments/social_ajax_comments.module
Outdated
Show resolved
Hide resolved
modules/social_features/social_comment/social_comment.tokens.inc
Outdated
Show resolved
Hide resolved
98fb495
to
1f82247
Compare
// possible | ||
$parents = $this->entityTypeManager->getStorage('taxonomy_term')->loadParents((int) $term->id()); | ||
// The number of parents determines the current depth. | ||
$depth = count($parents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kingdutch Please give this one a look. ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You pointed to OverviewTerms.php
in Drupal core as an example of where they use depth
so we can learn from them to make PHPStan happy.
// Depth should be added by Drupal core and is used in various places.
// However it's also not officially documented, so in case Drupal core has not
// made it available yet we load the depth ourselves and cache it on the term
// entity.
if (!isset($term->depth)) {
$parents = $this->entityTypeManager->getStorage('taxonomy_term')->loadParents((int) $term->id());
$term->depth = count($parents);
}
// To make PHPStan happy we assert that `depth` is now indeed numeric since the types defined for magic `__get` actually return `FIeldItemListInterface` which is not the case for our special `depth` property.
assert(is_numeric($term->depth), "Expected TermInterface item to have a numeric depth but the value was of incorrect type or unset.");
$choice = new \stdClass();
$choice->option = [$term->id() => str_repeat('-', $term->depth) . $this->entityRepository->getTranslationFromContext($term)->label()];
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Clear composer cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3d72470
to
aec6750
Compare
…PHP 8 and upadte OS to Drupal 9.3
…PHP 8 and upadte OS to Drupal 9.3
…PHP 8 and upadte OS to Drupal 9.3
…PHP 8 and upadte OS to Drupal 9.3
… int, Drupal\Core\Field\FieldItemListInterface given Typecasting directly for $term->depth is not solve this error. So, to fix it let's ensure that $term->depth is not a property of FieldItemListInterface and then typecast that value.
The property 'depth' is adding to the term in TermStorage::loadTree(), this is why we can't load it with the usual methods. Typecasting directly for $term->depth is not solve this error. So, to fix it we need to determine term depth with another approach.
This reverts commit 6bae937.
29a34d8
to
d87f13e
Compare
This reverts commit d87f13e.
Closing this PR due to rebase issues replaces by #2976 |
Problem
Add PHP 8 support to Open Social
Solution
Refactor code to support PHP 8 and maintain backward compatibility.
Issue tracker
https://www.drupal.org/project/social/issues/3260861
Theme issue tracker
N/A
How to test
Definition of done
Before merge
After merge
Screenshots
N.A
Release notes
We are now supporting PHP 8.0
Change Record
N.A
Translations
N.A