- Issue created by @alexpott
- First commit to issue fork.
- Status changed to Needs review
almost 2 years ago 12:31pm 15 March 2023 - 🇮🇳India Ranjit1032002
Uploaded a patch for the issue mentioned, please review.
Thank You. - Status changed to Needs work
almost 2 years ago 12:49pm 15 March 2023 - 🇫🇷France andypost
needs to replace
user_role_names()
too and deprecate both functions https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... → and add testUpdated IS
- Merge request !3701Deprecate user_roles() and user_role_names() #3348093 → (Closed) created by andypost
- Status changed to Needs review
almost 2 years ago 12:12am 23 March 2023 - 🇫🇷France andypost
Created MR - replaced all usage and deprecated
Needs reviews and polishing
- 🇫🇷France andypost
PHPStan reports false positive - it has no idea that roles has string IDs
Running PHPStan on *all* files. ------ --------------------------------------------------- Line core/modules/user/src/Form/RoleSettingsForm.php ------ --------------------------------------------------- 62 Cannot unset offset 'anonymous' on array<int, Drupal\user\Entity\Role>. 63 Cannot unset offset 'authenticated' on array<int, Drupal\user\Entity\Role>. ------ --------------------------------------------------- ------ ----------------------------------------------------- Line core/modules/user/src/Plugin/views/filter/Roles.php ------ ----------------------------------------------------- 57 Cannot unset offset 'anonymous' on array<int, Drupal\user\Entity\Role>. 58 Cannot unset offset 'authenticated' on array<int, Drupal\user\Entity\Role>. ------ ----------------------------------------------------- [ERROR] Found 4 errors
- 🇫🇷France andypost
- $roles = user_role_names(TRUE); - $roles = $this->roleStorage->loadMultiple(); + $roles = Role::loadMultiple(); ... $admin_roles = $this->roleStorage->getQuery()
Replaced
roleStorage
with staticloadMultiple()
solved fbut it needs follow-up - 🇫🇷France andypost
Filed issue to fix typing https://github.com/mglaman/phpstan-drupal/issues/522
- Status changed to Needs work
almost 2 years ago 1:56pm 23 March 2023 - Status changed to Needs review
almost 2 years ago 4:44pm 24 March 2023 - 🇫🇷France andypost
Updated baseline and reverted to injected storage
Meantime update of phpstan's baseline removed one false-positive
diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index 4b0b775af4..ae976aebef 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -880,11 +880,6 @@ parameters: count: 3 path: modules/block_content/tests/src/Kernel/Migrate/d6/MigrateCustomBlockContentTranslationTest.php - - - message: "#^Variable \\$book_links in empty\\(\\) is never defined\\.$#" - count: 1 - path: modules/book/book.module - - message: "#^Variable \\$callable in empty\\(\\) always exists and is not falsy\\.$#" count: 1
I did not commit guessing other issue
- Status changed to Needs work
almost 2 years ago 12:02am 26 March 2023 - 🇺🇸United States smustgrave
If we can update the IS and CR similar to 📌 Deprecate user_role_permissions() Fixed please
- First commit to issue fork.
- Status changed to Needs review
almost 2 years ago 10:40am 26 March 2023 - 🇫🇷France andypost
There's 3 threads are open in MR and it needs addressing, maybe in follow-up
Basically some places using to call
HTML::escape()
before using list of names forcheckboxes
but never forradios
form elements. Looking at code I think we can remove escaping as element doing that at render time.$roles = array_map(['\Drupal\Component\Utility\Html', 'escape'], $roles);
- 🇺🇸United States smustgrave
@Anchal_gupta this issue is being worked on in the MR not patches. Hiding patch 18 and updating credit.
- Status changed to Needs work
almost 2 years ago 2:08pm 27 March 2023 - 🇺🇸United States smustgrave
Actually NW per #17
There's 3 threads are open in MR and it needs addressing, maybe in follow-up
- Status changed to Needs review
almost 2 years ago 8:45pm 7 April 2023 - 🇫🇷France andypost
Removed escaping with extra commit and rebased
Also filed follow-up to remove 2 extra escaping 📌 Stop calling Html::escape() for checkbox options Needs work
- Status changed to RTBC
almost 2 years ago 1:06am 12 April 2023 - 🇺🇸United States smustgrave
Applied MR and did searches for user_role_names() and user_role() and all instances, minus trigger_error section, have been addressed.
IS was recently updated so think that's fine.
- Status changed to Needs work
almost 2 years ago 1:48am 12 April 2023 - First commit to issue fork.
- Status changed to Needs review
almost 2 years ago 2:25am 12 April 2023 - 🇧🇷Brazil murilohp
Just trying to move this forward, updated the code and fixed #23, moving back to NR
- Status changed to Needs work
almost 2 years ago 1:19pm 12 April 2023 - 🇺🇸United States smustgrave
quick look into the build I don't immediately see the why but seems there were some failure in the last commit. Needs investigating.
- Status changed to Needs review
almost 2 years ago 2:33pm 12 April 2023 - 🇫🇷France andypost
rebased, squashed 2 commits from murilohp and fixed it by filtering roles by permission first and then returning labels
- First commit to issue fork.
- 🇧🇷Brazil elber Brazil
Hi sorry @andypost I didn't see your comment before, I just did the rebase, I reverted the commit "initial-default" because it pushed non-related changes.
- 🇫🇷France andypost
@elber you can just use
git rebase -i HEAD~2
and drop useless commits as they will confuse reviewers - 🇫🇷France andypost
Removed this commits and rebased again (the failed test
CKEditor5AllowedTagsTest
is known as failing randomly) - Status changed to RTBC
almost 2 years ago 6:21pm 12 April 2023 - Status changed to Needs work
almost 2 years ago 12:09am 13 April 2023 - Status changed to Needs review
almost 2 years ago 6:59am 13 April 2023 - 🇫🇷France andypost
Thank you! fixed both points and reverted removal of
Html::escape()
for 📌 Stop calling Html::escape() for checkbox options Needs work - Status changed to Postponed
almost 2 years ago 10:16pm 15 April 2023 - 🇺🇸United States smustgrave
So there is a build failure, I believe because 📌 Stop calling Html::escape() for checkbox options Needs work needs to land first. So temporarily postponing this until that lands.
- last update
almost 2 years ago 29,202 pass - Status changed to Needs review
almost 2 years ago 10:49pm 15 April 2023 - 🇫🇷France andypost
No, it was typo - closing
)
in wrong place, I'm sure the 📌 Stop calling Html::escape() for checkbox options Needs work should go second at beta stage - Status changed to RTBC
almost 2 years ago 11:53pm 15 April 2023 - Status changed to Needs review
almost 2 years ago 8:02am 17 April 2023 - Status changed to Needs work
almost 2 years ago 8:23am 17 April 2023 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Unfortunately the deprecation message needs a bit of work as
Use to inline implementation instead.
doesn't make much sense. I think it should be something like:@trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead. See https://www.drupal.org/node/3349759', E_USER_DEPRECATED);
Note this needs fixing for both user_role_names() and user_roles().
@catch there's a follow-up for the escaping inconsistency - see 📌 Stop calling Html::escape() for checkbox options Needs work
- last update
almost 2 years ago 29,204 pass - 🇫🇷France andypost
@alexpott thanks, change message to suggested, and rebased
@catch
user_role_names()
doing thisarray_map()
but having wrapper function for single function call sounds bad idea. Moreover, places where we need labels from array of entities are not a lot but could be a global helper (follow-up?) - Status changed to RTBC
almost 2 years ago 4:52pm 23 April 2023 - 🇺🇸United States smustgrave
Lets see if we can get this in for 10.1
Seems #39 has been addressed.
And #40
places where we need labels from array of entities are not a lot but could be a global helper (follow-up?)
Think that should be a follow up as seems out of scope for this particular issue.
I can open that up if we all agree.
- Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
almost 2 years ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
almost 2 years ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
almost 2 years ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
almost 2 years ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Open on Drupal.org →Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - Status changed to Needs work
over 1 year ago 9:25am 12 June 2023 - 🇬🇧United Kingdom catch
Needs a re-roll for phpstan-baseline.neon (and also the deprecation version although that's also easy to fix on commit).
- Open on Drupal.org →Environment: PHP 8.2 & MySQL 8
49:19 49:19 Queueing - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - Status changed to Needs review
over 1 year ago 8:57pm 12 June 2023 - last update
over 1 year ago 29,443 pass - Status changed to RTBC
over 1 year ago 11:32pm 12 June 2023 - Status changed to Fixed
over 1 year ago 9:20am 14 June 2023 - 🇬🇧United Kingdom catch
OK let's go ahead without the helper method and rely on array_map(). Guessing we have quite a lot of usages in core compared to contrib. Also thanks for pointing me to the existing checkboxes issue.
Committed/pushed to 11.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.