All Projects → JetBrains → Phpstorm Attributes

JetBrains / Phpstorm Attributes

Licence: apache-2.0
PhpStorm specific attributes

Labels

Projects that are alternatives of or similar to Phpstorm Attributes

Idea Php Symfony2 Plugin
IntelliJ IDEA / PhpStorm Symfony Plugin
Stars: ✭ 797 (+469.29%)
Mutual labels:  phpstorm
Phpstorm Laravel Live Templates
Laravel Live Templates for PhpStorm
Stars: ✭ 1,157 (+726.43%)
Mutual labels:  phpstorm
Collector Intellij
A PhpStorm plugin for refactoring to collections
Stars: ✭ 114 (-18.57%)
Mutual labels:  phpstorm
Phpstorm Settings
PHPStorm - Facebook style theme, Live templates etc
Stars: ✭ 31 (-77.86%)
Mutual labels:  phpstorm
Phpstorm Ide Config
My PhpStorm configuration for writing modern PHP code
Stars: ✭ 55 (-60.71%)
Mutual labels:  phpstorm
Laravel Whoops Editor
Laravel Whoops Editor helps to open your code editor from exception stack trace.
Stars: ✭ 83 (-40.71%)
Mutual labels:  phpstorm
Dontbug
Dontbug is a reverse debugger for PHP
Stars: ✭ 710 (+407.14%)
Mutual labels:  phpstorm
Monaco Ide Font
〽️ Patched Monaco font for use in popular IDEs and editors
Stars: ✭ 127 (-9.29%)
Mutual labels:  phpstorm
Yaf Php Doc
YAF(Yet Another Framework)源码PHP移植版,同时提供了IDE Helper Doc的能力💡💡💡
Stars: ✭ 58 (-58.57%)
Mutual labels:  phpstorm
Phpstorm Solarized
Solarized theme for JetBrains PhpStorm
Stars: ✭ 93 (-33.57%)
Mutual labels:  phpstorm
Jetbrains Helper
Jetbrains helper
Stars: ✭ 33 (-76.43%)
Mutual labels:  phpstorm
Phpstorm Keymap Mac
PhpStorm For Mac Default Keymap Reference.
Stars: ✭ 36 (-74.29%)
Mutual labels:  phpstorm
Webstorm License Key
Instruction how use license key for WebStorm & all JetBrains products
Stars: ✭ 85 (-39.29%)
Mutual labels:  phpstorm
Runconfigurationasaction
Provides a way to use IntelliJ run configurations as buttons
Stars: ✭ 17 (-87.86%)
Mutual labels:  phpstorm
Symfony 4 Docker Env
Docker Environment for Symfony. PHP-FPM, NGINX SSL Proxy, MySQL, LEMP
Stars: ✭ 119 (-15%)
Mutual labels:  phpstorm
Awesome Phpstorm
A curated list of amazingly awesome PHPStorm plugins, resources and other shiny things.
Stars: ✭ 719 (+413.57%)
Mutual labels:  phpstorm
Phpinspectionsea
A Static Code Analyzer for PHP (a PhpStorm/Idea Plugin)
Stars: ✭ 1,211 (+765%)
Mutual labels:  phpstorm
Ide Stubs
Phalcon IDE Stubs
Stars: ✭ 137 (-2.14%)
Mutual labels:  phpstorm
Phpstorm Phpstan Plugin
PHPStan plugin for PhpStorm
Stars: ✭ 121 (-13.57%)
Mutual labels:  phpstorm
Symfony Phpstorm Meta
PhpStorm meta data for expected arguments completion.
Stars: ✭ 84 (-40%)
Mutual labels:  phpstorm

PhpStorm attributes

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

Learn more in the blog post.

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]

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

#[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\PHP 8\Foo::class,
])]
function functionName(...): array

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

ArrayShape

#[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

#[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

#[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

#[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

#[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

Bugs and feature requests

Please report any issues to the PhpStorm issue tracker https://youtrack.jetbrains.com/newIssue?project=WI.

Pull requests are also welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].