I have just noticed that methods setUserState() and getUserState() from JApplication are marked as deprecated.
But what are the replacements for these two methods ?
Thanks by advance
They are not deprecated, it's Joomla's documentation that is not perfect.
You can notice that it returns
JApplicationCms and on this object it is not deprecated. You will also notice that it says to look at
\JApplication for more information, but this object is deprecated. Just call the right object.
$app = JFactory::getApplication();
Next time you better click on the reference of the returned object and not the link it says to see for more details :)