User tests: Successful: Unsuccessful:
As static code analyzers, like PHPStan, become more and more popular, the isClient
function becomes obsolete. Instead should an instanceof
check be done, because then we know if the app specific function actually exists. Instead of
if ($application->isClient('site')) {
$application->getMenu()->getParams();
}
extensions should do:
if ($application instanceof \Joomla\CMS\Application\SiteApplication) {
$application->getMenu()->getParams();
}
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Why?
Do you remember isAdmin, isSite? that's why ;)
Deprecating is one thing, removing it another. Just because it is a similar function it doesn't mean we make the same mistake again as with isSite. You are mixing up things here, otherwise you can bring up the isSite problem on every deprecation.
Title |
|
if you have your own "Site" application it's no longer possible that way any more.
If you have your own, then you need to extend from the existing SiteApplication or at least implement the WebApplicatioinnInterface.
Labels |
Added:
RFC
PR-5.4-dev
|
This piece of code works reliable.
Maybe write a custom rule for PHPStan, what problem with that? does not look complicated https://phpstan.org/developing-extensions/rules
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-05-08 08:02:11 |
Closed_By | ⇒ | laoneo |
I think, with this you will make a loot people unhappy