phpstan / phpstan-deprecation-rules

PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
MIT License
378 stars 18 forks source link

Deprecated class is not detected #116

Open javaDeveloperKid opened 3 months ago

javaDeveloperKid commented 3 months ago

v1.2

I use deprecated class Doctrine\ORM\ORMException.

use Doctrine\ORM\ORMException; // detected deprecation by PHPStorm IDE

class MyClass 
{
  /**
   * @throws ORMException
   */ 
  function f() {}
}
/**
 * Base exception class for all ORM exceptions.
 *
 * @deprecated Use Doctrine\ORM\Exception\ORMException for catch and instanceof
 */
class ORMException extends Exception

However phpstan/phpstan-deprecated-rules does not report this. image

Double checked phpstan baseline if no one else has hidden this error.

It looks like this packages finds only method calls and not other statements (like use, catch for example).

ondrejmirtes commented 3 months ago

How are you using it in code? Please share code as text and not as screenshot.

Also share the declaration of the exception.

javaDeveloperKid commented 3 months ago

Updated issue description. I use it in @throws doc block or try..catch block.