How to identify deprecated code / know which code is deprecated?

263 views
Skip to first unread message

Ruud van Lent

unread,
Sep 17, 2017, 6:20:49 AM9/17/17
to Joomla! General Development
Hi,

just wondering what the best way is to identify deprecated code in a component.
I would like to have components use the latest and greatest, and while scanning the api documentation I see sometimes that code I use is deprecated (like addScriptVersion). So I change that code.
But it feels to me like this is a little bit by coincidence that I run into these.

Is there a more 'structural way' to periodically way (e.g. after every new Joomla release) to know which code has been deprecated (and replaced with what code)?

How do you handle this?

Niels Braczek

unread,
Sep 17, 2017, 6:30:23 AM9/17/17
to joomla-de...@googlegroups.com
Am 17.09.2017 um 12:20 schrieb Ruud van Lent:

> Is there a more 'structural way' to periodically way (e.g. after every new
> Joomla release) to know which code has been deprecated (and replaced with
> what code)?

Your IDE should do that for you. PhpStorm fx. marks deprecated methods
and properties (striketrough). The 'Inspect Code' function scans the
codebase and creates a list of deprecated calls. The replacements are
usually noted in the @deprecated annotation ("use ... instead").

Regards,
Niels

--
| New Stars on the Horizon: GreenCape · nibralab · laJoom |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------

Ruud van Lent

unread,
Sep 17, 2017, 6:33:51 AM9/17/17
to Joomla! General Development

Thanks Niels for the fast answer :)
I am currently using Eclipse... no love from that IDE I am afraid... Or I have missed a configuration option somewhere.

So should that also be possible with Eclipse?
Is there some kind of documentation per Joomla release with what code has been deprecated per version?

Niels Braczek

unread,
Sep 17, 2017, 6:37:32 AM9/17/17
to joomla-de...@googlegroups.com
Am 17.09.2017 um 12:33 schrieb Ruud van Lent:

> I am currently using Eclipse... no love from that IDE I am afraid... Or I
> have missed a configuration option somewhere.
> So should that also be possible with Eclipse?

I don't know Eclipse - haven't touched for years.

> Is there some kind of documentation per Joomla release with what code has
> been deprecated per version?

Usually, the release notes come with that information (changelog).

Ruud van Lent

unread,
Sep 18, 2017, 3:18:46 AM9/18/17
to Joomla! General Development
Hi, It turned out I missed a configuration setting: I have set my development web (joomla) directory as include path in my projects. Now Eclipse also shows the phpdoc for joomla (library) functions: including deprecated and replace with :)

Thanks for triggering me on this Niels!

Ruud van Lent

unread,
Sep 25, 2017, 4:33:17 AM9/25/17
to Joomla! General Development
And then Joomla 3.8 was released... Well that ended the joy of me having a deprecated code indicator in eclipse.
I think this has to do with the switch to name spacing in the Joomla libraries.
When including joomla 38 in the include directory code completion / lookup doesn't work anymore, when switching back to joomla 37 as included directory it does work.

Anyone else see this or has an (IDE) fix / workaround for this?

This is not only Eclipse related, I am currently investigating switching to Geany and I see the same 'problem' in that IDE :(

Michael Babker

unread,
Sep 25, 2017, 7:47:42 AM9/25/17
to joomla-de...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-dev-general@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Ruud van Lent

unread,
Sep 25, 2017, 10:09:29 AM9/25/17
to Joomla! General Development
Thnx Michael,

learning every day :)

Ruud van Lent

unread,
Sep 26, 2017, 3:27:13 AM9/26/17
to Joomla! General Development
Just a thought: would it be possible (or is it already possible) to make detection of deprecated functions part of e.g. PHPCS for Joomla?
That way it is IDE independent and you would get a full list of used deprecated methods / /classes etc.  to work with for your project?

Daniel Loureiro

unread,
Oct 22, 2017, 5:26:16 PM10/22/17
to Joomla! General Development
On Tuesday, September 26, 2017 at 12:27:13 AM UTC-7, Ruud van Lent wrote:
> Just a thought: would it be possible (or is it already possible) to make detection of deprecated functions part of e.g. PHPCS for Joomla?

+1 for the "PHPCS for Joomla" idea. I'd love to have this functionality in my editor (Atom). Is there any place where we can submit this suggestion?

Ruud van Lent

unread,
Oct 23, 2017, 2:46:45 AM10/23/17
to Joomla! General Development
Suggestion was already submitted here: https://github.com/joomla/coding-standards/issues/208
Need to look in what this takes, have some discussion about how to do it and then just do it :)
Reply all
Reply to author
Forward
0 new messages