Replace the test helpers Drupal 11.5 deprecated, which fail the next major phpstan job (3.x backport)
Backport of !462 (merged) to 3.x. The changeset is line for line identical to what merged on 4.x as 991c0e69.
3.x supports ^10.2 || ^11, so every replacement has to predate 10.2, and all three do: UserCreationTrait::grantPermissions() is in 10.2 with the body it still has and BrowserTestBase imports the trait there aliasing only createRole and createUser; RoleInterface::revokePermission() and RoleInterface::ANONYMOUS_ID are in 10.2; and BrowserTestBase::xpath() in 10.2 is buildXPathQuery() followed by findAll('xpath', ...), which the single call site reaches with no arguments.
Nothing reports these on 3.x today: the branch sets OPT_IN_TEST_NEXT_MAJOR: 0 so it has no phpstan (next major) job, and its current lane is on core 11.4.5. This is for parity with 4.x, and to avoid adding three more entries to the deprecated-core-API ignores in phpstan.neon once 11.5 lands.
The previous major lane is the one that matters here, since it is what actually exercises Drupal 10.