I'm looking for an extension for Joomla! 4.0 to replace a deprecated method which was used to load an user by userid. The method used actually is:
$user = Factory::getUser($userid);
The issue is that in the error log it is recommended to use
Factory::getApplication()->getIdentity() instead, but this method doesn't accept params! The other method that I found is
Factory::getApplication()->loadIdentity(), but this one accepts User object as its parameter.
So which is the non-deprecated method to load a user object by passing userid?