User tests: Successful: Unsuccessful:
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
Title |
|
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?
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.
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.
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.
Do phpdoc has a @aliasof
tag?
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:
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:
@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).So, this PR has my for Joomla 3.x series. And probably another similar PR for Joomla 2.5 the other way around could also be made.
"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
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.
@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.
Travis failed anyway. So either there is a bug in the test or this PR introduces a bug.
2.5 supports PHP 5.2 which doesn't support namespaces so we can't backport any namespacing efforts there.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-14 12:11:27 |
Title |
|
Title |
|
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