? ? ? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
18 Dec 2021

Summary of Changes

When using the extract function in PHP you should always document what vars are being created, this is especially important when using IDE's and static analysis tools.

Testing Instructions

code review - dump $displayData if you wish and check

Screenshot 2021-12-18 at 15 39 53

Actual result BEFORE applying this Pull Request

$params and $module are undefined in the method and IDEs struggle to understand what is happening

Expected result AFTER applying this Pull Request

Better code quality

Documentation Changes Required

avatar PhilETaylor PhilETaylor - open - 18 Dec 2021
avatar PhilETaylor PhilETaylor - change - 18 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Dec 2021
Category Libraries
avatar toivo toivo - test_item - 28 Dec 2021 - Tested successfully
avatar toivo
toivo - comment - 28 Dec 2021

I have tested this item successfully on 1487477

Tested successfully in 4.0.6-dev using PHP 8.0.13.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36348.

avatar Fedik
Fedik - comment - 28 Dec 2021

It more useful to have in the module layouts, in each tmpl/blabla.php Instead of Dispatcher.
Also $buttons not available for all modules, you probably have checked QuickIcon module.

avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

what I did was run get_defined_vars and then document them...

avatar Fedik
Fedik - comment - 28 Dec 2021

"Global variables" is set here:

protected function getLayoutData()
{
return [
'module' => $this->module,
'app' => $this->app,
'input' => $this->input,
'params' => new Registry($this->module->params),
'template' => $this->app->getTemplate()
];
}

There no "buttons" as you can see ?

But it exists in QuickIcon Dispatcher.

avatar PhilETaylor
PhilETaylor - comment - 28 Dec 2021

In fact my screenshot proves what I did, I did not use get_defined_vars I used dd($displayData)

Anyway, the only two that are needed to stop static analysis breaking are modules and params...

avatar PhilETaylor PhilETaylor - change - 28 Dec 2021
Labels Added: ?
avatar Fedik Fedik - test_item - 28 Dec 2021 - Tested successfully
avatar Fedik
Fedik - comment - 28 Dec 2021

I have tested this item successfully on 79b5b26


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36348.

avatar Quy
Quy - comment - 16 Jan 2022

I have tested this item successfully on 571f0b3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36348.

avatar Quy Quy - test_item - 16 Jan 2022 - Tested successfully
avatar Quy Quy - alter_testresult - 16 Jan 2022 - Fedik: Tested successfully
avatar Quy Quy - change - 16 Jan 2022
Status Pending Ready to Commit
avatar Quy
Quy - comment - 16 Jan 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36348.

avatar bembelimen bembelimen - change - 25 Jan 2022
Labels Added: ?
avatar bembelimen bembelimen - close - 25 Jan 2022
avatar bembelimen bembelimen - merge - 25 Jan 2022
avatar bembelimen bembelimen - change - 25 Jan 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-01-25 03:28:06
Closed_By bembelimen
Labels Added: ?
avatar bembelimen
bembelimen - comment - 25 Jan 2022

Thx

Add a Comment

Login with GitHub to post a comment