I have a problem with the new PhpStorm built-in annotations described in https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/
This is the code:
use JetBrains\PhpStorm\NoReturn;
#[NoReturn] public function __construct() {}
When I now run my Phan static analyser I get the following errors:
PhanUndeclaredClassAttribute Reference to undeclared class \JetBrains\PhpStorm\NoReturn in an attribute
How can I fix this? Do I have to composer install some lib from JetBrains to have these annotations in my code base?
How can I fix this? Do I have to composer install some lib from JetBrains to have these annotations in my code base?
Yes, please see https://github.com/JetBrains/phpstorm-attributes
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