-
-
Save Seldaek/b7a3bd28920c6cc181e67a829b13a81c to your computer and use it in GitHub Desktop.
Attribute Syntax Comparisons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FooCurrent { | |
/** | |
* @ORM\Id | |
* @ORM\GeneratedValue | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* Some sensible description | |
* | |
* @Assert\Length(max=255) | |
* @Assert\NotBlank() | |
* @ORM\Column(type="string", nullable=true) | |
* @Groups({"public", "address"}) | |
*/ | |
private $email; | |
} | |
class FooAtAt { | |
@@ORM\Id | |
@@ORM\GeneratedValue | |
@@ORM\Column(type="integer") | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
@@Assert\Length(max=255) | |
@@Assert\NotBlank() | |
@@ORM\Column(type="string", nullable=true) | |
@@Groups({"public", "address"}) | |
private $email; | |
} | |
class FooHashBrackets { | |
#[ORM\Id] | |
#[ORM\GeneratedValue] | |
#[ORM\Column(type="integer")] | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
#[Assert\Length(max=255)] | |
#[Assert\NotBlank()] | |
#[ORM\Column(type="string", nullable=true)] | |
#[Groups({"public", "address"})] | |
private $email; | |
} | |
class FooHashBracketsGrouped { | |
#[ | |
ORM\Id, | |
ORM\GeneratedValue, | |
ORM\Column(type="integer") | |
] | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
#[ | |
Assert\Length(max=255), | |
Assert\NotBlank(), | |
ORM\Column(type="string", nullable=true), | |
Groups({"public", "address"}) | |
] | |
private $email; | |
} | |
class FooAtBrackets { | |
@[ORM\Id] | |
@[ORM\GeneratedValue] | |
@[ORM\Column(type="integer")] | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
@[Assert\Length(max=255)] | |
@[Assert\NotBlank()] | |
@[ORM\Column(type="string", nullable=true)] | |
@[Groups({"public", "address"})] | |
private $email; | |
} | |
class FooAtBracketsGrouped { | |
@[ | |
ORM\Id, | |
ORM\GeneratedValue, | |
ORM\Column(type="integer") | |
] | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
@[ | |
Assert\Length(max=255), | |
Assert\NotBlank(), | |
ORM\Column(type="string", nullable=true), | |
Groups({"public", "address"}) | |
] | |
private $email; | |
} | |
class FooShifts { | |
<<ORM\Id>> | |
<<ORM\GeneratedValue>> | |
<<ORM\Column(type="integer")>> | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
<<Assert\Length(max=255)>> | |
<<Assert\NotBlank()>> | |
<<ORM\Column(type="string", nullable=true)>> | |
<<Groups({"public", "address"})>> | |
private $email; | |
} | |
class FooShiftsGrouped { | |
<< | |
ORM\Id, | |
ORM\GeneratedValue, | |
ORM\Column(type="integer") | |
>> | |
private $id; | |
/** | |
* Some sensible description | |
*/ | |
<< | |
Assert\Length(max=255), | |
Assert\NotBlank(), | |
ORM\Column(type="string", nullable=true), | |
Groups({"public", "address"}) | |
>> | |
private $email; | |
} |
@@Attribute
is the only rational decision
Based on what rationale?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like
@@Attribute
is the only rational decision, so the PHP internals will go with something else, of course.None of them write actual PHP or manage PHP teams for a living.