4

I'm currently working on an old project that needs migrating to PHP 5.5 from 5.3

I found out that its possible to have PhpStorm find all deprecated function calls within a project (as per Find all deprecated usage in the project) and to a degree it seems to work really well.

However it does not seem to be flagging the now deprecated mysql method calls (of which we have quite a lot). At first I thought this was a PHP version issue but I have checked the settings and PhpStorm is set to use 5.5

The only thing I can seem to find to explain this is that when I ctrl+click on the mysql function calls the phpDoc block for that method does not have an @deprecated attribute.

/**
 * (PHP 4, PHP 5)<br/>
 * Close MySQL connection
 * @link http://php.net/manual/en/function.mysql-close.php
 * @param resource $link_identifier [optional] 
 * @return bool true on success or false on failure.
 */
function mysql_close ($link_identifier = null) {}

Instead this is in the header:

// Start of mysql v.1.0
// @deprecated in 5.5 entire extension is deprecated in favour of mysqli

Is there a way for me to get PhpStorm to recognise that these functions are deprecated or am I going to have to resort to searching the project?

Note: Mysql functions are pretty simple but what if another modules with less standard modules is disabled?

Community
  • 1
  • 1
James
  • 2,609
  • 3
  • 20
  • 27
  • Please check this answer: http://stackoverflow.com/questions/19134303/phpstorm-find-all-deprecated-usages-in-the-project. Is it suitable for you? – Gino Pane Oct 22 '15 at 08:52
  • @GinoPane - Nope, that's how I'm getting the list of deprecated functions but the mysql functions aren't being listed. – James Oct 22 '15 at 14:32
  • What is your PhpStorm version? – LazyOne Oct 22 '15 at 15:34
  • @James, here's what I got for this inspection: http://prntscr.com/8u4x5w. As you can see deprecated functions are listed after inspection and even striked out in editor. I'm using PhpStorm 9.0.2. – Gino Pane Oct 22 '15 at 17:49
  • @LazyOne I'm using PHPStorm8 – James Oct 23 '15 at 10:34
  • 1
    @James Well -- you need PhpStorm v9.0.2 at least -- it works there just fine. P.S. You may try [v10 EAP build](http://blog.jetbrains.com/phpstorm/2015/10/phpstorm-10-public-preview/) (sort-of beta -- not stable release; can be run alongside; has own 30-days license so can be used even if your current license is expired) – LazyOne Oct 23 '15 at 11:29
  • Confirm working on 9.0.2 version. – Gino Pane Oct 23 '15 at 11:54
  • I've updated and that has resolved my issue. Does one of you want to post a answer so I can accept it? – James Oct 23 '15 at 14:31

1 Answers1

0

The latest stable version of PhpStorm v9.0.2 and it definitely has mysql_ functions marked as deprecated (checked both 9.0.2 and 10 EAP build).

Your version 8 may still have older stubs without @deprecated tags for those functions.

LazyOne
  • 158,824
  • 45
  • 388
  • 391