PHPackages                             php-static-analysis/attributes - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. php-static-analysis/attributes

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

php-static-analysis/attributes
==============================

Attributes used instead of PHPDocs for static analysis tools

0.5.0(1y ago)9499.5k↓49.6%7MITPHPPHP &gt;=8.1CI passing

Since Feb 9Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (8)Versions (27)Used By (7)

PHP Static Analysis Attributes
==============================

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

[![Continuous Integration](https://github.com/php-static-analysis/attributes/workflows/All%20Tests/badge.svg)](https://github.com/php-static-analysis/attributes/actions)[![Latest Stable Version](https://camo.githubusercontent.com/9179934956ac2b41a706efaa64884ab0732fc143f8611999d4a3aa6750406f71/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f617474726962757465732f762f737461626c65)](https://packagist.org/packages/php-static-analysis/attributes)[![License](https://camo.githubusercontent.com/b81ef6322c206d999ed5b74c4f7e094055874b56d7e19526d0fcadbd3502cbc8/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f617474726962757465732f6c6963656e7365)](https://github.com/php-static-analysis/attributes/blob/main/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/7b7854d167d73f7a527c93d26518c92f1bdeeb0030c39b2021936f10b7bae962/68747470733a2f2f706f7365722e707567782e6f72672f7068702d7374617469632d616e616c797369732f617474726962757465732f646f776e6c6f616473)](https://packagist.org/packages/php-static-analysis/attributes/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 or Psalm or IDEs like PhpStorm or VS Code have not made this transition to attributes and they still rely on annotations in PHPDocs for a lot of their functionality.

This library aims to provide a set of PHP attributes which could replace the most commonly used annotations accepted by these tools and will aim to provide related repositories with the extensions or plugins that would allow these attributes to be used in these tools.

In particular, these repositories are:

- [PHPStan extension](https://github.com/php-static-analysis/phpstan-extension)
- [Psalm plugin](https://github.com/php-static-analysis/psalm-plugin)
- [RectorPHP rules to migrate annotations to attributes](https://github.com/php-static-analysis/rector-rule)

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:

```
