? Failure

User tests: Successful: Unsuccessful:

avatar zero-24
zero-24
21 May 2014

How to reproduce

1) just open any file with JRegistry used in phpstorm or NetBeans or eclipse.
2) See that with CRL or CMD hover and click you can't access the class and (at least in phpstorm, they are displayed as yellow errors)
3) apply this patch
4) and all those warnings disappear and you can control-click on it to access the definition

Thanks @beat

Tracker

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33768&start=0

avatar zero-24 zero-24 - open - 21 May 2014
avatar zero-24 zero-24 - change - 21 May 2014
Title
Create registry.php
Fix IDE Problems with JRegistry
avatar wilsonge
wilsonge - comment - 22 May 2014

I dunno if I like this really - but if you're gonna do this you should probably remove the classmap stuff here: https://github.com/joomla/joomla-cms/blob/staging/libraries/classmap.php

avatar betweenbrain
betweenbrain - comment - 22 May 2014

I'm not a fan of adding code the CMS just to appease an error or warning in and IDE. Doesn't that indicate another issue? Are we going to do this elsewhere in the future?

avatar asika32764
asika32764 - comment - 22 May 2014

I also don't like using an empty class to fix this but I think it is important and developer friendly.

Since we include more and more framework classes, we will need a solution to solve this problem.

avatar betweenbrain
betweenbrain - comment - 22 May 2014

I agree that it is important and we need to make things as friendly as possible.

Is there another way to solve this issue than an empty class? As @asika32764 rightly points out, this issue will grow as we bring in more of the framework.

avatar Bakual
Bakual - comment - 22 May 2014

Is there another way to solve this issue than an empty class?

From my understanding one could also add use Joomla\Registry\Registry at the top of each file which makes use of the Registry package. That is adding the namespace to the file. It's probably the "correct" way but wouldn't solve the issue for 3rd parties. However 3rd parties can of course do the same change in their files to please their IDE.

Or we could just change the doc blocs which refer to JRegistry to Joomla\Registry\Registry. That should solve it as well.

avatar asika32764
asika32764 - comment - 22 May 2014

Do phpdoc has a @aliasof tag?

avatar beat
beat - comment - 22 May 2014

Agree with @Bakual that the other way would be ok, but only in a major release 4.0, as it doesn't fix the warnings for the 7000+ extensions.

As (also) a third party extension developer, having my own files suddenly showing many medium-level warnings, that I systematically avoid in my files, about an apparently (from IDE perspective) removed Joomla API (and then going to Joomla and seeing same issues), and that in a minor upgrade gives me a "wtf happened" feeling:

  1. "Do Joomla devs use a decent IDE that highlights potential issues ?"
  2. "Do they care about their new versions development strategy ?"

Doing such things in a major release which cleanly introduces namespacing as the new standard way to go and deprecating the old use is sure "ok", to warn me and 3pds that the non-namespaced version will be deprecated soon. But then I would expect more:

  1. A @deprecated statement with instruction for new way instead (which results in a low-level warning that I have time to address, instead of a medium-level warning that requires immediate attention).
  2. A back-port of the namespaced version (e.g. with same trick the other way around) into Joomla 2.5 so my extensions continue to work on both with the new way.

So, this PR has my :+1: for Joomla 3.x series. And probably another similar PR for Joomla 2.5 the other way around could also be made.

avatar Bakual
Bakual - comment - 22 May 2014

"Do they care about their new versions development strategy ?"

As for that, it's easy. The first release under the new strategy is yet to be released. It will be 3.4 (or 3.3.1 if you want). 3.3.0 has been released under the old strategy, we couldn't have raised the PHP minimum requirement otherwise :smiley:

A back-port of the namespaced version (e.g. with same trick the other way around) into Joomla 2.5 so my extensions continue to work on both with the new way.

Honestly I don't think that makes a lot of sense. 2.5 will reach end of life this year, and it's possible to write extensions which are compatible both with 2.5 and 3.x. They will likely show PHP strict warnings already due to change signatures, but that's fine as long as it works. The same for this one here: We have a classmap in place which makes sure extensions using JRegistry still work. The only issue is that the IDE will show a warning. That doesn't really justify backporting a new library with namespaces.

avatar beat
beat - comment - 22 May 2014

@Bakual In case you didn't notice my 2 questions were a bit joking regarding myself, but i can easly guess other extensions developers would ask them seriously. ;-)

PHP minimum version raise had a hard reason for it. This one doesn't.

Well, if the new way is to use namespaces and to deprecate non-namespaced uses, then a backport is needed to keep compatibility with the namespaced API.

However, I really can't care less of this stupid issue. But I am each time amazed how much lines of arguing is needed for obvious simple fixes. This makes contributing back to joomla less fun, and makes me and others reading our threads think twice too.

avatar Bakual
Bakual - comment - 22 May 2014

Travis failed anyway. So either there is a bug in the test or this PR introduces a bug.

avatar mbabker
mbabker - comment - 22 May 2014

2.5 supports PHP 5.2 which doesn't support namespaces so we can't backport any namespacing efforts there.

avatar Bakual
Bakual - comment - 24 Jun 2014

I did a PR which changes some doc blocs from JRegistry to Joomla\Registry\Registry.
See #3823 and tell me what you think.

avatar zero-24 zero-24 - change - 14 Jul 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-14 12:11:27
avatar zero-24 zero-24 - change - 14 Jul 2014
Title
Fix IDE Problems with JRegistry
[#33768] Fix IDE Problems with JRegistry
avatar zero-24 zero-24 - close - 14 Jul 2014
avatar zero-24 zero-24 - close - 14 Jul 2014
avatar zero-24 zero-24 - change - 14 Jul 2014
Title
Fix IDE Problems with JRegistry
[#33768] Fix IDE Problems with JRegistry
avatar zero-24 zero-24 - head_ref_deleted - 14 Jul 2014

Add a Comment

Login with GitHub to post a comment