 [ ← blog / phpstan ](/) Jul 02, 2019  ·  \#phpstan  ·  3 min read 

# Deprecation message support for PHPStan



The end of May brought two exciting releases for PHPStan and the PHPStan Deprecation Rules extension. With the version of [PHPStan](https://github.com/phpstan/phpstan) [v0.11.8](https://github.com/phpstan/phpstan/releases/tag/0.11.8), descriptions added to the `@deprecated` tag can be parsed and returned in rule checks. The [v0.11.2](https://github.com/phpstan/phpstan-deprecation-rules/releases/tag/0.11.2) of the [PHPStan Deprecation Rules extension](https://github.com/phpstan/phpstan-deprecation-rules) implements this feature and returns that description instead of a generic "Call to deprecated X Y" messaging.

     ![Profile module deprecated message output](/sites/default/files/styles/large/public/deprecated-messages-example.png?itok=0lqHb2vG) 

 

It is exciting to see this functionality in the wild. The [original feature request](https://github.com/phpstan/phpstan-deprecation-rules/issues/2), from November 2018, required feature development on PHPStan's [phpdoc-parser](https://github.com/phpstan/phpdoc-parser) and PHPStan itself. The first bits of code landed in mid-March and the complete functionality released by the end of May. Gábor Hojtsy has already updated the [Upgrade Status module](https://www.drupal.org/project/upgrade_status) to take advantage of these features.

> [](https://twitter.com/gaborhojtsy/statuses/1139319979172671489)



 

Drupal Check was a little behind, but the ability to display messages now exists. The [v1.0.11 ](https://github.com/mglaman/drupal-check/releases/tag/1.0.11)release will display deprecated code usage descriptions. The tool currently requires a development tag of PHPStan until v0.11.9 is released. Drupal Check performs some unique loading techniques to support various ways users are installing the tool which broke in PHPStan v0.11.8.

Here are those commits, for those interested:

- [Ignore files using a stream wrapper](https://github.com/phpstan/phpstan/commit/bf4e560b898dd77e5d4b22978e5fddece3d7a364), loading configurations which prefixed with `phar://` were causing errors when using the Drupal Check binary
- [Support PhpAdapter for configurations](https://github.com/phpstan/phpstan/commit/bba5b37a46ee5fc7db20239a610d9c63817b00e1), to support project-level installations and global Composer installs, PHP configuration is used to discover the vendor directory dynamically. Support for the PhpAdapter had to be added back.

Contributing to another project has been a fun and challenging experience. PHPStan uses the Nette framework, and this has been my first experience working with its components. It also involved contributing to different projects to ensure a piece of functionality was available. My initial work was done in PHPStan itself, which was hacky. Ondřej identified it should belong in the `phpdoc-parser` library. I have briefly worked with PHP in an abstract-syntax tree format or as tokens but never trying to extract description messages based off a tag in a document block. All I can say is thank you Derick Rethans for creating and maintaining Xdebug. Without the ability to use Xdebug for step debugging, I would have spent many more days working through this code.

## Support Open Source

If you are using any of these open source tools, I highly recommend supporting their maintainers.

All of my work for Drupal Check and PHPStan has been supported by [Centarro](https://www.centarro.io/company?utm_source=glamanate&utm_medium=blog&utm_campaign=centarro_companty) for our [Centarro Toolbox + Support](https://www.centarro.io/products/centarro-toolbox?utm_source=glamanate&utm_medium=blog&utm_campaign=centarro_toolbox), as part of our Quality Monitor service.

Support PHPStan development through its Patreon page: <https://www.patreon.com/join/phpstan>

Support Xdebug through Derick Rethans' Patreon page: <https://www.patreon.com/bePatron?u=7864328>

 

  ![](/themes/custom/mglaman/images/headshot.webp)Thanks for reading

I write about Drupal, PHP, and the quiet infrastructure behind large sites — caching, config, and testing. New posts land every week or two.

 [Subscribe via RSS →](/rss.xml) [About me →](/about-me) 

 



 

  [← Older

A proper introduction to Drupal Check

 ](/blog/proper-introduction-drupal-check) [Newer →

Using ReactPHP to run Drupal tasks

 ](/blog/using-reactphp-run-drupal-tasks)