RFC PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
5 May 2025

Summary of Changes

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();
}

Link to documentations

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

avatar laoneo laoneo - open - 5 May 2025
avatar laoneo laoneo - change - 5 May 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 May 2025
Category Libraries
avatar Fedik
Fedik - comment - 5 May 2025

I think, with this you will make a loot people unhappy

avatar laoneo
laoneo - comment - 5 May 2025

Why?

avatar Fedik
Fedik - comment - 5 May 2025

Do you remember isAdmin, isSite? that's why ;)

avatar laoneo
laoneo - comment - 5 May 2025

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.

avatar richard67 richard67 - change - 6 May 2025
Title
[6.0] [RFC] Deprecates isClient function in application interface
[5.4] [RFC] Deprecates isClient function in application interface
avatar richard67 richard67 - edited - 6 May 2025
avatar HLeithner
HLeithner - comment - 7 May 2025

if you have your own "Site" application it's no longer possible that way any more.

avatar laoneo
laoneo - comment - 7 May 2025

If you have your own, then you need to extend from the existing SiteApplication or at least implement the WebApplicatioinnInterface.

avatar laoneo laoneo - change - 7 May 2025
Labels Added: RFC PR-5.4-dev
avatar Fedik
Fedik - comment - 8 May 2025

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

avatar laoneo laoneo - change - 8 May 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-05-08 08:02:11
Closed_By laoneo
avatar laoneo laoneo - close - 8 May 2025

Add a Comment

Login with GitHub to post a comment