phpstorm-attributes icon indicating copy to clipboard operation
phpstorm-attributes copied to clipboard

php7.4 No attribute is effective.

Open aogg opened this issue 2 months ago • 0 comments

PhpStorm 2025.1.2

https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/


Fortunately, the syntax of one-line attributes is backward compatible. This means that if you add the #[ArrayShape] attribute in a separate line in your PHP 7.* project, the PHP interpreter will parse it as just a line comment and you won’t get a parse error. However, multiline attributes are not safe for versions of PHP prior to 8.

Unlike the PHP interpreter, PhpStorm will analyze attributes anyway! So even if your project runs on PHP 7.4 or lower, you still benefit from adding #[ArrayShape] attributes.


aogg avatar Dec 12 '25 03:12 aogg