I have an issue with different behaviour by replacing deprecated code. On my extension dedicated for Joomla! 3.10 i used this part of code :
$userid = $this->input->getInt('userid');
$this->user = Factory::getUser($userid);
On the version of my extension dedicated for Joomla! 4.2.x i replaced by that :
$userid = $this->input->getInt('userid');
$this->user = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById($userid);
On the case of $userid is null the call after to load the uersid doesn't work i get that :
Joomla\CMS\User\UserFactory::loadUserById(): Argument #1 ($id) must be of type int, null given, called in ...