Search code examples
phpphpstorm

PhpStorm ignoring module deprecation


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?


Solution

  • 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.