1.2.1343. Use PHP Attributes¶
This rule reports if PHP 8.0 attributes are in use.
Attributes look like special comments #[`... <https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list>`_]
. They are linked to classes, traits, interfaces, enums, class constants, functions, methods, and parameters.
<?php
#[foo(4)]
class x {
}
?>
See also PHP RFC: Shorter Attribute Syntax, Attributes Amendements and Shorter Attribute Syntax Change.
1.2.1343.1. Connex PHP features¶
1.2.1343.1.1. Specs¶
Short name |
Php/UseAttributes |
Rulesets |
|
Exakat since |
2.1.6 |
PHP Version |
With PHP 8.0 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |