1.2.760. Nested Attributes¶
Nested attribute are attribute in attributes. Nested attributes are not available in PHP 8.0 and older. It is reported as an invalid constant expression.
<?php
// Extracted from PHP 8.1 addendum (https://www.php.net/releases/8.1/en.php#new_in_initializers)
class User
{
#[\Assert\All(
new \Assert\NotNull,
new \Assert\Length(min: 6))
]
public string $name = '';
}
?>
See also PHP RFC: New in initializers and New initializers.
1.2.760.2. Connex PHP features¶
1.2.760.2.1. Specs¶
Short name |
Attributes/NestedAttributes |
Rulesets |
All, Appinfo, Changed Behavior, CompatibilityPHP73, CompatibilityPHP74, CompatibilityPHP80 |
Exakat since |
2.3.1 |
PHP Version |
With PHP 8.1 and more recent |
Severity |
|
Time To Fix |
|
Changed Behavior |
PHP 8.1 - More |
Precision |
Very high |
Available in |