User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This intents to be a procedural improvement rather than a fix or a feature.
The Joomla\CMS\Router\Route::_
can get a Joomla\CMS\Uri\Uri
parameter, which is later instantiated again as Uri object.
It creates a new object of the same type from the passed one, for no reason. The created object is a clone of the passed.
To be able to check the change, you need to debug the code at the point where the change is applied.
Try adding a code like the following in a layout file.
<?php
$uri = Joomla\CMS\Uri\Uri::getInstance('index.php?option=com_content&view=category');
?>
<a href="<?php echo Joomla\CMS\Router\Route::_($uri)?>">A content link</a>
Although we pass a Uri object, it creates a new one of the same type from our passed object.
Uses the passed Uri object
DKN
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
line 190 is used 15 times. So I wonder if a saving of 1
Thanks for testing!
The number of times each function is used, depends on the developer's implementation.
IMHO this is not something that should concern the API developers.
I have tested this item
I have tested this item
set RTC
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-11-30 14:37:09 |
Closed_By | ⇒ | laoneo | |
Labels |
Thanks!
I have tested this item✅ successfully on 3b2ce06
I put the test code in the Cassiopeia index.php file just before the end of main. I needed to add use Joomla\CMS\Router\Route; at the top and I had to use one of my own menu link routes, otherwise there are errors. With all that done, and the patch applied, line 186 is used once and line 190 is used 15 times. So I wonder if a saving of 1 in 15 is really worth it.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31432.