?
avatar brianteeman
brianteeman
27 Jul 2018

I am continuing the work to namespace the librafries/src folder and I have a few questions

  1. $classname = 'Joomla\CMS\Date\Date';
    stays as it is or changes to $classname = Date and add a use statement at the top of the file

  2. \JLoader::import('joomla.filesystem.stream');
    stays as it is or removed and add a use statement at the top of the file

avatar brianteeman brianteeman - open - 27 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jul 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Jul 2018
avatar roland-d
roland-d - comment - 27 Jul 2018

For me it works like this:

  1. changes to $classname = Date and add a use statement at the top of the file
  2. I am currently not aware this can be done any different.
avatar brianteeman
brianteeman - comment - 27 Jul 2018

thanks

avatar wilsonge
wilsonge - comment - 27 Jul 2018

Wrong on both :P

  1. It's the string of the class not a class instance so you need the use statement and $classname = Date::class (that just allows easier future refactoring in IDE's)
  2. JLoader imports where special cases where we named classes in weird ways that didn't conform to Joomla's built in autoloader. So yes you can remove it and replace it with a use statement with the namespaced classes as it will work just fine with the composer autoloader
avatar brianteeman
brianteeman - comment - 27 Jul 2018

JLoader imports where special cases where we named classes in weird ways that didn't conform to Joomla's built in autoloader. So yes you can remove it and replace it with a use statement as it will work just fine with the composer autoloader

Isnt that where we can do
use joomla\cms\blah\blah as ginger

??

avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Jul 2018
Category Code style
avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Jul 2018
Status New Discussion
avatar wilsonge
wilsonge - comment - 27 Jul 2018

you don't need the as even :)

avatar brianteeman
brianteeman - comment - 27 Jul 2018

thanks

avatar brianteeman brianteeman - change - 27 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-27 11:55:37
Closed_By brianteeman
avatar brianteeman brianteeman - close - 27 Jul 2018

Add a Comment

Login with GitHub to post a comment