I propose @{Attr} for the attributes syntax.
Pro:
- no bc breaks
- end delimiter
- some similarity to docblock annotations (same es
@@,@:and@[]) - looks less like an array (compared to
@[Attr]and#[Attr]) - for me it fits well to the grouped use syntax (
use App\{Foo, Bar, Baz as Qux}), where{}is already used for a comma separated list
Con:
- no forward compatibility
- not used by any other language
- the grouped multiline variant looks a bit like a silenced block
@{
ORM\Entity,
ORM\Table("user")
}
class User
{
@{ORM\Id, ORM\Column("integer"), ORM\GeneratedValue}
private $id;
@{ORM\Column("string", ORM\Column::UNIQUE)}
@{Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])}
private $email;
}@beberlei Is it possible to include this in https://wiki.php.net/rfc/shorter_attribute_syntax_change? Since there will be a STV anyway, I think it doesn't hurt to have one more option to choose from.