PHPackages                             php-static-analysis/phpstan-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. php-static-analysis/phpstan-extension

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

php-static-analysis/phpstan-extension
=====================================

PHPStan extension to read static analysis attributes

0.5.0(11mo ago)1529.6k↑14.4%6MITPHPPHP &gt;=8.1CI passing

Since Feb 9Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/php-static-analysis/phpstan-extension)[ Packagist](https://packagist.org/packages/php-static-analysis/phpstan-extension)[ GitHub Sponsors](https://github.com/carlos-granados)[ RSS](/packages/php-static-analysis-phpstan-extension/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (26)Used By (6)

PHP Static Analysis Attributes PHPStan Extension
================================================

[](#php-static-analysis-attributes-phpstan-extension)

[![Continuous Integration](https://github.com/php-static-analysis/phpstan-extension/workflows/All%20Tests/badge.svg)](https://github.com/php-static-analysis/phpstan-extension/actions)[![Latest Stable Version](https://camo.githubusercontent.com/684a5f4dd262f25c08368fb6b579ec77f239814bc7b9ab803ba83a88406a2c1d/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f7068707374616e2d657874656e73696f6e2f762f737461626c65)](https://packagist.org/packages/php-static-analysis/phpstan-extension)[![License](https://camo.githubusercontent.com/3ff49202ec6d0f3b025f37561123a9937b92cace0be372cd119c3ae0ade84e38/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f7068707374616e2d657874656e73696f6e2f6c6963656e7365)](https://github.com/php-static-analysis/phpstan-extension/blob/main/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/896752bb69adddb38447ffe92bfbd436a62e5d5651c42251b088505de50bc957/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f7068707374616e2d657874656e73696f6e2f646f776e6c6f616473)](https://packagist.org/packages/php-static-analysis/phpstan-extension/stats)

Since the release of PHP 8.0 more and more libraries, frameworks and tools have been updated to use attributes instead of annotations in PHPDocs.

However, static analysis tools like PHPStan have not made this transition to attributes and they still rely on annotations in PHPDocs for a lot of their functionality.

This is a PHPStan extension that allows PHPStan to understand a new set of attributes that replace the PHPDoc annotations. These attributes are defined in [this repository](https://github.com/php-static-analysis/attributes)

Example
-------

[](#example)

In order to show how code would look with these attributes, we can look at the following example. This is how a class looks like with the current annotations:

```
