PHPackages                             jetbrains/phpstorm-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jetbrains/phpstorm-attributes

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jetbrains/phpstorm-attributes
=============================

PhpStorm specific attributes

1.2(1y ago)41416.0M—9.1%11[7 issues](https://github.com/JetBrains/phpstorm-attributes/issues)20Apache-2.0PHP

Since Nov 17Pushed 1y ago219 watchersCompare

[ Source](https://github.com/JetBrains/phpstorm-attributes)[ Packagist](https://packagist.org/packages/jetbrains/phpstorm-attributes)[ RSS](/packages/jetbrains-phpstorm-attributes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (20)

[![official JetBrains project](https://camo.githubusercontent.com/3b986829d614bc9d575b508f1c8cea701c5cc9639dee6b2c4413b71dbc25d961/68747470733a2f2f6a622e67672f6261646765732f6f6666696369616c2e737667)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)

PhpStorm attributes
===================

[](#phpstorm-attributes)

Use these PHP 8 attributes in PhpStorm to get more advanced code completion and analysis.

Learn more in the [blog post](https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/).

Installation
------------

[](#installation)

The attributes are available in PhpStorm 2020.3 and later. They are bundled with PhpStorm so you don’t need to install them separately.

If you are using other static analysis tools and don’t want to get Class not found issues, then you might want to add the attributes package to your composer.json as a dev dependency:

```
composer require --dev jetbrains/phpstorm-attributes

```

`#[Deprecated]`
---------------

[](#deprecated)

Use this attribute when you want to notify users that an entity will be removed in the future.

Provide the explanation tip in `reason` and updating suggestion in `replacement`.

```
#[Deprecated(
    reason: 'since Symfony 5.2, use setPublic() instead',
    replacement: '%class%->setPublic(!%parameter0%)'
)]
```

[![Deprecated](https://camo.githubusercontent.com/84d811b0226d9688475f58363aea7d85d21213e773481b16e9160789e219a67b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f646570726563617465645f73796d666f6e792e676966)](https://camo.githubusercontent.com/84d811b0226d9688475f58363aea7d85d21213e773481b16e9160789e219a67b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f646570726563617465645f73796d666f6e792e676966)

`#[ArrayShape]`
---------------

[](#arrayshape)

Use Array Shape when you deal with object-like arrays and want to specify the keys’ names and types for values to get better coding assistance.

```
#[ArrayShape([
 // 'key' => 'type',
    'key1' => 'int',
    'key2' => 'string',
    'key3' => 'Foo',
    'key3' => App\PHP8\Foo::class,
])]
function functionName(...): array
```

> The attribute works with PHP ≤ 7.4 if specified in one line.

[![ArrayShape](https://camo.githubusercontent.com/55d43d8f91442a9e0daaceca61d6ec47b788c0bb55f1d58ce48f6cf86fce6df0/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f617272617973686170652e676966)](https://camo.githubusercontent.com/55d43d8f91442a9e0daaceca61d6ec47b788c0bb55f1d58ce48f6cf86fce6df0/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f617272617973686170652e676966)

`#[ObjectShape]`
----------------

[](#objectshape)

The attribute specifies possible object field names and their types. If applied, an IDE will suggest the specified field names and infer the specified types.

```
#[ObjectShape(["age" => "int", "name" => "string"])]
function functionName(): object {...}

$obj = functionName();
```

This usage effectively means that the `$obj` has 2 fields, the names are `age` and `name`, and the corresponding types are `int` and `string`.

`#[Immutable]`
--------------

[](#immutable)

Mark properties or entire objects with this attribute if you want to guarantee they won't be changed after initialization.

```
#[Immutable]
class DTO
{
    public string $val;

    public function __construct(string $val)
    {
        $this->val = $val;
    }
}
```

> The attribute works with PHP ≤ 7.4 if specified in one line.

[![Immutable](https://camo.githubusercontent.com/ac02189251a2a93d8400ffb28d6c08e40f6a8caf9c156a5cff648267222ed88b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f696d6d757461626c652e706e67)](https://camo.githubusercontent.com/ac02189251a2a93d8400ffb28d6c08e40f6a8caf9c156a5cff648267222ed88b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f696d6d757461626c652e706e67)

`#[Pure]`
---------

[](#pure)

Use this attribute for functions that do not produce any side effects. All such PHP internal functions are already marked in PhpStorm.

```
#[Pure]
function compare(Foo $a, Foo $b): int
{
    return $a->a  $b->b;
}
```

[![Pure](https://camo.githubusercontent.com/a4c7f3b4075f21ab98c65d3e561b1d3c2e4749059aec4551f578e989292515e1/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f707572655f6164642e706e67)](https://camo.githubusercontent.com/a4c7f3b4075f21ab98c65d3e561b1d3c2e4749059aec4551f578e989292515e1/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f707572655f6164642e706e67)

`#[ExpectedValues]`
-------------------

[](#expectedvalues)

Use this attribute to specify which values exactly a function accepts as parameters and which it can return. This will improve coding assistance.

```
function response(
    #[ExpectedValues(valuesFromClass: Response::class)] $httpStatusCode,
    //...
) {
    //...
}
```

[![ExpectedValues](https://camo.githubusercontent.com/b9497fe80d4bddbd4da8550b76fac1c6dc5dbbc7292d1cdac42f64027eaaa50b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f636f756e745f657870656374656476616c75652e706e67)](https://camo.githubusercontent.com/b9497fe80d4bddbd4da8550b76fac1c6dc5dbbc7292d1cdac42f64027eaaa50b/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f636f756e745f657870656374656476616c75652e706e67)

`#[NoReturn]`
-------------

[](#noreturn)

Mark functions that terminate script execution as exit points with this attribute to get a more accurate control flow analysis.

```
#[NoReturn]
function redirect(): void {
   //...
   exit();
}
```

[![NoReturn](https://camo.githubusercontent.com/2e7475f18771d30223dbe2fac1d275c8efa6dbbeb256ba1b26d8449a00ff277f/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f6e6f72657475726e2e676966)](https://camo.githubusercontent.com/2e7475f18771d30223dbe2fac1d275c8efa6dbbeb256ba1b26d8449a00ff277f/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f6e6f72657475726e2e676966)

`#[Language]`
-------------

[](#language)

Add this attribute to mark string parameters that contain text in some other \[programming\] language, for example, RegExp, SQL, and so on. This will improve highlighting and reveal additional features of PhpStorm for you.

[![Language](https://camo.githubusercontent.com/a13ddb996ba619c8ea44789f96e67487f5ed0c4f6b3108f2aea4d6cd9cfe5172/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31322f6174747269627574655f6c616e67756167652e676966)](https://camo.githubusercontent.com/a13ddb996ba619c8ea44789f96e67487f5ed0c4f6b3108f2aea4d6cd9cfe5172/68747470733a2f2f626c6f672e6a6574627261696e732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31322f6174747269627574655f6c616e67756167652e676966)

Bugs and feature requests
-------------------------

[](#bugs-and-feature-requests)

Please report any issues to the PhpStorm issue tracker .

Pull requests are also welcome.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity66

Solid adoption and visibility

Community53

Growing community involvement

Maturity56

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~712 days

Total

3

Last Release

584d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa54ef3f5a094dc9ef7ec7fcf389b96d21418e4d68fc1a12f3f3b89a8601c2b4?d=identicon)[maxim.kolmakov](/maintainers/maxim.kolmakov)

![](https://www.gravatar.com/avatar/4e4e6c5cdba23ea68c8719243c790469c4f29cd53cf0ff5610148bfddf4261a6?d=identicon)[neuro159](/maintainers/neuro159)

![](https://www.gravatar.com/avatar/4bd0d2156cc7d5b57f59481686305f06b78e1cd94a540c1d4237449b5ea660d7?d=identicon)[wbars](/maintainers/wbars)

![](https://www.gravatar.com/avatar/ce180087f0c7ee6786102330114e44703cd4e2e905312c387bf0f2688085c251?d=identicon)[pronskiy](/maintainers/pronskiy)

![](https://www.gravatar.com/avatar/21475a107b4d57f9826a293c6f2244ae039ff2378c22e6a9aa7e5369c55c9ca7?d=identicon)[pestretsov](/maintainers/pestretsov)

---

Top Contributors

[![pestretsov](https://avatars.githubusercontent.com/u/3885667?v=4)](https://github.com/pestretsov "pestretsov (3 commits)")[![wbars](https://avatars.githubusercontent.com/u/5152749?v=4)](https://github.com/wbars "wbars (3 commits)")[![isfedorov](https://avatars.githubusercontent.com/u/37301285?v=4)](https://github.com/isfedorov "isfedorov (1 commits)")[![krzysztofrewak](https://avatars.githubusercontent.com/u/10898728?v=4)](https://github.com/krzysztofrewak "krzysztofrewak (1 commits)")[![andypost](https://avatars.githubusercontent.com/u/73713?v=4)](https://github.com/andypost "andypost (1 commits)")[![packbier](https://avatars.githubusercontent.com/u/22497985?v=4)](https://github.com/packbier "packbier (1 commits)")[![pronskiy](https://avatars.githubusercontent.com/u/1196825?v=4)](https://github.com/pronskiy "pronskiy (1 commits)")[![marcreichel](https://avatars.githubusercontent.com/u/7645035?v=4)](https://github.com/marcreichel "marcreichel (1 commits)")[![DeyV](https://avatars.githubusercontent.com/u/311626?v=4)](https://github.com/DeyV "DeyV (1 commits)")

---

Tags

php8phpstormphpstormjetbrainsattributes

### Embed Badge

![Health badge](/badges/jetbrains-phpstorm-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/jetbrains-phpstorm-attributes/health.svg)](https://phpackages.com/packages/jetbrains-phpstorm-attributes)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[jetbrains/phpstorm-stubs

PHP runtime &amp; extensions header files for PhpStorm

1.4k27.7M68](/packages/jetbrains-phpstorm-stubs)[phalcon/ide-stubs

The most complete Phalcon Framework IDE stubs library which enables autocompletion in modern IDEs.

1623.1M121](/packages/phalcon-ide-stubs)[bazilio/yii2-stubs-generator

Yii2 component stubs generator for Yii::$app

146720.4k1](/packages/bazilio-yii2-stubs-generator)[spiral/attributes

PHP attributes reader

233.6M45](/packages/spiral-attributes)[spatie/php-attribute-reader

A clean API for working with PHP attributes

80216.4k11](/packages/spatie-php-attribute-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
